Jest: Clean install of Jest Circus results in 'runtime.unstable_shouldLoadAsEsm' error

Created on 21 Apr 2020  ·  6Comments  ·  Source: facebook/jest

🐛 Bug Report

When I run my tests, I get the following message for each suite:

 FAIL  __tests__/automatic/office/seo.test.js
  ● Test suite failed to run

    TypeError: runtime.unstable_shouldLoadAsEsm is not a function

      at jestAdapter (node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:125:23)

To Reproduce

  1. Delete any existing node_modules and package.lock and jest.config.js
  2. npm i
  3. npm install --save-dev jest-circus
  4. add "testRunner": "jest-circus/runner" to the jest config.
  5. run jest

Expected behavior

Not to get this error but for my tests to run

Link to repl or repo (highly encouraged)

https://repl.it/repls/LopsidedLightgreyBlogware

envinfo

  System:
    OS: macOS High Sierra 10.13.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
  Binaries:
    Node: 10.16.0 - /usr/local/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
  npmPackages:
    jest: ^24.8.0 => 24.9.0 
Bug Report Needs Repro Needs Triage

Most helpful comment

I had difference between minor version and still got this error. Making sure that jest and jest-circus are both 25.4.0 solved this error for me.

All 6 comments

You need to match the major of jest-circus with the major of jest. In this case you're installing v25 of circus and v24 of jest. Should probably be specified in the docs... Wanna send a PR updating the docs with this information? "The docs" being jest-circus's readme I guess

I had difference between minor version and still got this error. Making sure that jest and jest-circus are both 25.4.0 solved this error for me.

Hmm, might need to add a guard for that... Did npm/yarn print any peer dependency warnings?

I too had the same problem. I was facing this issue in version 25.4.0. Try to change the jest-circus version to 25.3.0. This works for me.

Did npm/yarn print any peer dependency warnings?

Did npm/yarn print any peer dependency warnings?

I observed the same thing and no peer dependency warnings

Was this page helpful?
0 / 5 - 0 ratings