Skip to content

Instantly share code, notes, and snippets.

@yairEO
Last active January 27, 2016 06:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yairEO/d281bf017d203556f96c to your computer and use it in GitHub Desktop.
Save yairEO/d281bf017d203556f96c to your computer and use it in GitHub Desktop.
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