TypeError: Cannot read property '_location' of null on ubuntu 16.10

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:19 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
brandonaaskovcommented, Oct 27, 2017

@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 on window. 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 that jsdom 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.

2reactions
brandonaaskovcommented, Oct 27, 2017

@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 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm ERR! Cannot read properties of null ... - Stack Overflow
Go to folder -> Local > npm-cache and delete all contents of the npm-cache. try again with npm command, it should work now....
Read more >
cannot read properties of null (reading '0') react - You.com
Solution: The TypeError: Cannot read properties of null (reading 'data') occurs when your first render, your data with that id isn't mounted to...
Read more >
Cannot read property 'meetingProp' of undefined when ...
I've deployed a running server of bigbluebutton with greenlight and now I would to apply some changes to the file "bigbluebutton-html5".
Read more >
CSR Error: Cannot read property 'style' of null
Debugging it, it seems to be failing on: var row = document.getElementById(rowId); and always coming up null. Any ideas why it wouldn't be...
Read more >
Cannot Read Property Length of Undefined in JavaScript
The TypeError: Cannot read property 'length' of undefined is one of the most common type errors in JavaScript. It occurs when the length ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found