question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dependency on `jest-validate` breaks tests in create-react-app

See original GitHub issue

If 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

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
SimenBcommented, Mar 25, 2018

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).

1reaction
stevensackscommented, Apr 3, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found