Skip to content

Instantly share code, notes, and snippets.

@yairEO
Last active January 27, 2016 06:27
How to setup mocha with jQuery using jsdom
var chai = require('chai'),
expect = chai.expect,
should = chai.should(),
jsdom = require('jsdom'),
window = jsdom.jsdom().defaultView;
describe('a basic test', () => {
it('should pass when all is ok', (done) => {
jsdom.jQueryify(window, "../js/vendor/jquery.min.js", () => {
var $ = window.$;
// test something:
(!!1).should.be.true;
done();
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment