jest: document is not defined & puppeteer
See original GitHub issue🐛 Bug Report
I have asked about the problem on stackoverflow for a week ago without any answer question (( I have configured jest as described jest for puppeteer but suddenly I’ve got the errot on usual test with document event listeners
To Reproduce
Steps to reproduce the behavior:
- configure jest to work with puppeteer
- write test for React App which is using event listeners
Expected behavior
pass test without errors
Link to repl or repo (highly encouraged)
https://github.com/budarin/react-ssr-bootstrap-project
Run `npx envinfo --preset jest
System:
OS: macOS High Sierra 10.13.5
CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Binaries:
Node: 10.6.0 - /usr/local/bin/node
yarn install v0.15.1
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 15.39s. - /usr/local/bin/yarn
npm: 6.2.0-next.1 - /usr/local/bin/npm
npmPackages:
jest: ^23.3.0 => 23.3.0
Issue Analytics
- State:
- Created 5 years ago
- Comments:20
Top Results From Across the Web
Why I got document is not defined error in puppeteer?
I think document would only be available within page.evaluate (according to puppeteer documentation ). Try: async function gallery(page) ...
Read more >jest referenceerror: document is not defined - You.com | The AI ...
I get this error ReferenceError: AudioContext is not defined in all of my Jest tests. I don't use it in my test cases...
Read more >How To Fix ReferenceError document is not defined ... - Isotropic
If you are trying to use the document object and receiving a ReferenceError: document is not defined error then there is a good...
Read more >Using with puppeteer - Jest
Generating code coverage for test files using Puppeteer is currently not possible if your test uses page.$eval , page.
Read more >How to fix ReferenceError: Document is not defined ... - Sabe.io
The most common reason for this error is because you're using Node. That is to say, you are trying to access the document...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Again, this isn’t a help forum - please ask questions on discord
It’s not a question - it’s a bug to have only one type of tests!