Charlie Fish Charlie Fish - 1 year ago 215
Node.js Question

Zombie.js jQuery Load Error 'j.getClientRects is not a function'

So first I have read this Stack Overflow question and it doesn't look like my same issue.

Basically I'm trying to use Mocha and Zombie.js to run some tests on my Node.js site.

I'm trying to check to see if I can create a user. In the end I would like to check to see if my bootstrap modal exists. Basically I have the bootstrap modal wrapped in an EJS

statement so there is defiantly a chance it might not exist. So that is why I'm trying to run tests on it.

But currently it's not even working with
so I'm currently just trying to solve this before moving on to checking for elements.

browser.visit('/login', function() {
browser.fill('email', '');
browser.fill('password', 'testtest');
browser.pressButton('Login').then(function() {
}).then(done, done);

In this case I should be running the following code on the page the browser is currently on.


When running this unit test it gives me the following error.
}return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(M(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),"object"!=typeof b&&"function"!=typeof b||(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(||({}),,void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f}}function S(a,b,c){if(M(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpan
TypeError: j.getClientRects is not a function
at k (
at Object.n.extend.pixelMarginRight (
at a.getComputedStyle.Sa (
at Function.n.extend.css (
at Y (
at n.fn.extend.css (
at c.setScrollbar (
at (
at .<anonymous> (

Looks to me like for some reason Zombie.js isn't loading jQuery on that page or there is an error. But in that previous Stack Overflow question and answer at the beginning of the question it looks like Zombie.js can load jQuery.

Are you not able to load jQuery with Zombie.js? How can I fix this? Seems like a very simple thing to test pages with jQuery. Any ideas?

Let me know if you need any additional information or anything. Thanks.

EDIT for some reason when downgrading to jQuery version
it seems to work and the error goes away. Any reason for this?

Answer Source

This bug is fixed :

Adopting jsdom 8/9 as the fix for your problem was harder than I wanted. It should be pretty easy to add a dummy implementation for getClientRects() just to get past that specific failure. I'll try that and see how it goes

Add a stub implementation of getClientRects() was straightforward. I've published 5.0.1 with a fix for this specific failure.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download