-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test not actually using jest-environment-jsdom-fourteen #7491
Comments
I'm also seeing this issue, and attempting to set it my self with
I'm running react-scripts 3.0.1 as well. |
A temporary work-around may be:
|
|
Doh. Thanks for reporting. Unfortunately this will likely have to wait until the next major release so we don't break people's tests by switching now. The workaround provided by @sfbwalder should work well. There's also |
thanks @sfbwalder although not so temporary 😂 -- this issue ate up at least a day for me -- |
Describe the bug
Although createJestConfig sets the
testEnvironment
tojest-environment-jsdom-fourteen
, it doesn't actually end up making its what into Jest. If you create a new project with create-react-app and runyarn test --showConfig
, you will get output similar to:The
testEnvironment
ends up still usingjest-environment-jsdom
instead ofjest-environment-jsdom-fourteen
.Did you try recovering your dependencies?
Yes, created a brand new project.
Which terms did you search for in User Guide?
jest-environment-jsdom-fourteen
Environment
Environment:
OS: macOS 10.14
Node: 10.15.0
Yarn: 1.17.3
npm: 6.9.0
Watchman: 4.9.0
Xcode: Xcode 10.1 Build version 10B61
Android Studio: Not Found
Packages: (wanted => installed)
react: ^16.8.6 => 16.8.6
react-dom: ^16.8.6 => 16.8.6
react-scripts: 3.0.1 => 3.0.1
Steps to reproduce
Expected behavior
jest-environment-jsdom-fourteen should be used when running
yarn test
.Actual behavior
jest-environment-jsdom is used.
Reproducible demo
I created this project using create-react-app that demonstrates the issue: https://github.com/TLadd/jest-testenv-app. Again, if you go into a newly created project and run
yarn test --showConfig
, you can observe that thetestEnvironment
is not set correctly.I also added two tests that demonstrate that the older version of jsdom is being used:
App.js
App.test.js
It's taking advantage of a known bug in the older jsdom that has since been fixed. When clicking a span inside a submit button, it doesn't trigger the form to submit.
So by default, the first test passes and the second on fails. If I go into
node_modules/react-scripts/scripts/test.js
and manually set this lineThen both tests pass.
The text was updated successfully, but these errors were encountered: