How can I test custom JavaScript app (including jQuery as a dependency)? I have tried jQuery as Node package with no success...
Do I need to define it somehow in the test suite dependencies? I tried this:
define([
'intern!bdd',
'intern/chai!expect',
'node-jquery'
], ...
You’re on the right track. If you are trying to load and test arbitrary JavaScript, you just do so like this:
define([
'intern!bdd',
'intern/chai!expect',
'libs/jquery.js',
'app/foo.js',
'app/bar.js'
], function (bdd, expect) {
bdd.describe('my test', function () {
bdd.it('should find foos on the page', function () {
expect(jQuery('.foo')).to.have.length.of.at.least(2);
});
});
// access other global variables here
});