jsdom: TypeError: Cannot read property '_location' of null on ubuntu 16.10
Here’s the important bit of my output:
RUNS src/components/Analyse/Widget/Criteria/DateRange.test.js
/home/capaj/git_projects/be/frontend-be.com/node_modules/jsdom/lib/jsdom/browser/Window.js:148
return idlUtils.wrapperForImpl(idlUtils.implForWrapper(window._document)._location);
^
TypeError: Cannot read property '_location' of null
at Window.get location [as location] (/home/capaj/git_projects/be/frontend-be.com/node_modules/jsdom/lib/jsdom/browser/Window.js:148:79)
at Timeout.callback [as _onTimeout] (/home/capaj/git_projects/be/frontend-be.com/node_modules/jsdom/lib/jsdom/browser/Window.js:525:40)
at ontimeout (timers.js:380:14)
at tryOnTimeout (timers.js:244:5)
at Timer.listOnTimeout (timers.js:214:5)
This happens with jest 19.0.2, node 7.7.2 and jsdom “9.11.0”. My colleagues with Macbooks don’t get this error. I get it randomly in any testcases which happen to run at that time.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 19 (6 by maintainers)
@Zirro and @domenic, I haven’t been able to isolate it to the line yet, but I’m 95% sure the culprit is the
redux-persist
package (at least in my case), which makes sense given its reliance onwindow
. If I completely remove that package from my project, the problem goes away.I haven’t been able to replicate this issue with a standalone project with some basic tests (not including
redux-persist
yet). This just further shows thatjsdom
is not the culprit.I’m about to check out for the weekend but wanted to mention that in case it helps future travelers. I’ll keep digging on this over the next week.
I am seeing this issue is well. I can’t share my code, because I have no clue what is triggering this. It shows when I run my
jest
tests.The funny thing is that on my MacBook Pro, I don’t see it. But in my CI environment which is Linux based I do.
I never saw it before today.
@Zirro I’ve been plugging away at it trying to track it down. I actually don’t think it’s a jsdom issue either, but I still haven’t figured out the root cause. I’m building up from the most basic example I can think of to try and reproduce the problem. My current thinking is that it’s actually related to one of the redux packages we’re using, but we’ll see. I’ll report back with my findings 😃