node.js - JQuery via JSDom isn't a functor giving TypeError -


with io.js 1.3.0 using jsdom 4.0.1 mocha 2.0.1 , jquery 2.1.1 on windows

the following code:

 var chai = require('chai');  var jsdom = require('jsdom');  describe('jsdom', function () { var $;  beforeeach(function () {     global.document = jsdom.jsdom('<html><body><section id="banner"></section></body></html>');     global.window = global.document.defaultview;     global.navigator = global.window.navigator;      $ = global.jquery = require('jquery')(global.window); })  it('using jquery', function () {     var dom = $("#banner"); }); }); 

errors out typeerror: object not function when trying use jquery selector functor (i.e. $(...)). else run , have workaround?

the issue setting set global.window , global.document. jquery checking find out if running in browser.

this causes require('jquery')(global.window) wrap window instead of running jquery factory function, $(window) would.


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -