dependency on `jest-validate` breaks tests in create-react-app
See original GitHub issueIf you are using create-react-app and upgrade to link-staged 7.0.0 all your test starts to fail because of TypeError: environment.dispose is not a function
Reason is that lint-staged 7.0.0 started to depend on jest-validate
which depends on jest-environment-node
and there is clash between different versions of jest-environment-node
from CRA and list-staged.
npm ls jest-environment-node
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
How to fix broken Jest in React 16.4.1 with CRA and debug ...
Once I upgraded to React 16.4.1 using Create React App for my training course, my Jest tests failed with a strange error: ...
Read more >Running Tests | Create React App
Jest is a Node-based runner. This means that the tests always run in a Node environment and not in a real browser. This...
Read more >create-react-app dependency version issues with React 18
Go back to your root folder and run npx create-react-app my-app (your app name) --template file:PATH_TO_YOUR_CUSTOM_TEMPLATE.
Read more >React app testing: Jest and React Testing Library
Learn how to test React applications with Jest and React Testing Library, a popular combination and official recommendation from React.
Read more >Complete Guide to Unit Tests with React | by Mr. Dibre | Medium
I'll create a new React project using npx create-react-app unit-tests-tutorial --template typescript , create-react-app uses jest and react-testing-library ...
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
This is a jest issue (https://github.com/facebook/jest/issues/5294), which has been fixed. CRA uses jest 20 though, which still has the bug (upgraded to 22 in the alpha).
It doesn’t happen to me if I npm install lint-staged into an existing project, either. But if I delete package-lock.json and node_modules and then run npm install with lint-staged 7.x in my package.json, that’s when it breaks.