jest: jest: document is not defined & puppeteer
π 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
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 20 (3 by maintainers)
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!
@thymikee to write
in every unit test - it is little bit annoing but it partially solves the problem
We also have whole documentation on how to separate your tests and use different environments for different needs (e.g. server and browser). Please spend some time reading it before raging on the issue tracker π
@SimenB I know it, but question was: how to have
testEnvironment
at the same time to beJSDOM
andNode
? We need not only one type of tests - we need them both at the same timehttps://jestjs.io/docs/en/configuration#testenvironment-string https://jestjs.io/docs/en/configuration#projects-array-string-projectconfig