How to specify outside resources for tests?
Closed this issue · 5 comments
How do we specify where to find outside resources like jQuery for tests?
Backstory:
Parsley is a fairly popular jQuery plugin for web validations. We'd love to port Parsley to ES6. We're trying this project to do so. @guillaumepotier doesn't have much time to fiddle with the setup, and I'm quite ignorant about tooling (and not that eager to change that fact, tbh).
I think it would be a good goal for this project that such a porting require very little changes to the boilerplate install, do you agree? So I thought it might be a good idea to report difficulties we're having.
We have a branch for that. The import
s work fine for the Parsley code, but I don't know how to import jQuery in tests. Hopefully it's simple. It is, of course, completely out of the question to bundle jQuery with Parsley's dist/
files...
Any help would be greatly appreciated.
@marcandre , requiring in 3rd party libs in the tests should be the same as requiring them in the library itself. Usually I'll do...
// some-unit-test.js
import MyLib from '../../path/to/my-lib';
import $ from 'jquery';
// ...tests here
Is this not working for you?
@marcandre , I left a comment over on that PR. It was typed pretty quickly, so do let me know if it's too vague. I'd love to help ya get that PR landed!
@marcandre , is this good to close?
Yes! Thanks so much for your help 😄
Rad. No problem - I'm happy to help! Hopefully we can get Parsley in the green soon :)