jest v28 environment error
See original GitHub issueVerify canary release
- I verified that the issue exists in Next.js canary release
Provide environment information
Operating System:
- Platform: win32
- Arch: x64
- Version: Windows 7 Ultimate Service Pack 1
Binaries:
- Node: 12.22.1
- npm: N/A
- Yarn: N/A
- pnpm: N/A
Relevant packages:
- next: 12.1.7-canary.4
- react: 17.0.2
- react-dom: 17.0.2
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
With jest
of version 28+ npm run test
ends in this error:
● Validation Error:
Test environment jest-environment-jsdom cannot be found. Make sure the testEnvironment configuration option points to an existing node module.
Configuration Documentation:
https://jestjs.io/docs/configuration
As of Jest 28 "jest-environment-jsdom" is no longer shipped by default, make sure to install it separately.
I’ve looked at the jest-environment-jsdom
page and have some reservations about installing packages without a readme. So I thought jsdom
would suffice, but it’s doesn’t and crashes with the same error.
Expected Behavior
Not crashing on test start.
To Reproduce
git clone https://github.com/GabenGar/repros.git repros
cd repros/nextjs/jest-env-error
npm install
npm run test
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
From v27 to v28 - Jest
Upgrading Jest from v27 to v28? This guide aims to help refactoring your configuration and tests.
Read more >[Bug]: regression in v28 · Issue #12759 · facebook/jest - GitHub
I've fully removed both node_modules and package-lock.json file without results. Environment. System: OS: Linux 5.15 Ubuntu 22.04 LTS 22.04 ( ...
Read more >Error Test environment jest-environment-jsdom cannot be ...
I'm receiving an error: Error: Test environment jest-environment-jsdom cannot be found. Make sure the testEnvironment configuration option ...
Read more >babel-jest - Awesome JS
[docs] Update link to Jest 28 upgrade guide in error message (#13483) ... [jest-environment-node] make globalThis.performance writable for Node 19 and fake ...
Read more >jest - npm
Delightful JavaScript Testing.. Latest version: 29.3.1, last published: 2 months ago. Start using jest in your project by running `npm i ...
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
The docs should already be updated in https://github.com/vercel/next.js/pull/36632, but it won’t show up on the documentation page before our next stable release.
I’ll make sure to update our
with-jest
example to use Jest 28 as well.This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.