Jest: Jest 23 and react-scripts are conflicting

Created on 25 May 2018  ยท  7Comments  ยท  Source: facebook/jest

Jest 23 when run with react-scripts in my project is throwing:

TypeError: environment.teardown is not a function
  at node_modules/jest-runner/build/run_test.js:188:25

When I remove with yarn remove jest I assume my tests are using the react-scripts version of Jest (locked at 22.4.3) and the tests run normally.

Locking my version with yarn add [email protected] --dev doesn't solve this issue.

This issue is obviously related to something within react-scripts and perhaps should be opened on that project but I can't figure out what is going on and at least by creating the issue, I might save someone else from the research time that I've spent trying to track it down.

Most helpful comment

Sorry, I was incorrect. react-scripts is locked at 20.0.4 - when I lock my project to Jest 20.0.4, (yarn add [email protected] --dev) tests run as expected.

(I was accidentally looking at @next branch)

All 7 comments

Sorry, I was incorrect. react-scripts is locked at 20.0.4 - when I lock my project to Jest 20.0.4, (yarn add [email protected] --dev) tests run as expected.

(I was accidentally looking at @next branch)

You cannot install your own version of jest with CRA. I'm sure they'd like a PR upgrading, though!

How do I use Enzyme in this project? Every time this error occurs. Missing "jest-cli", I used it. This error appeared.

Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

I have got my tests running okay locally but when I run them on bitbucket pipeline I get this error;

โ— Test suite failed to run TypeError: environment.teardown is not a function at node_modules/jest-runner/build/run_test.js:230:25

I am facing the same issue @joeynimu

Hi!,
i had the same issue and this resolve
Yarn add [email protected] --dev,
maybe the version of jest have conflict.
I Hope this helped

Was this page helpful?
0 / 5 - 0 ratings