jest icon indicating copy to clipboard operation
jest copied to clipboard

[Bug]: jest-circus/build/runner.js in the testRunner option was not found on MacOS/jest30

Open eavdmeer opened this issue 5 months ago • 18 comments

Version

30.0.3

Steps to reproduce

  1. Use a system running MacOS 15.5 on ARM.
  2. Clone this repostitory: git clone 'https://github.com/eavdmeer/jest-30-bug/'.
  3. Run 'npm install'.
  4. Run 'npm test'.

Expected behavior

There should be output showing a successful test:

$ npm test

> [email protected] test
> jest --env node --passWithNoTests

 PASS  ./index.test.js
  add tester
    ✓ add two numbers (2 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        0.147 s, estimated 1 s
Ran all test suites.

Actual behavior

Initial run of npm fails with error output:

$ npm test

> [email protected] test
> jest --env node --passWithNoTests

[[email protected]] Trying to install package "@unrs/resolver-binding-darwin-arm64" using npm
● Validation Error:

  Module /Users/someone/Developer/jest-30-bug/node_modules/jest-circus/build/runner.js in the testRunner option was not found.
         <rootDir> is: /Users/someone/Developer/jest-30-bug

  Configuration Documentation:
  https://jestjs.io/docs/configuration

Additional context

  • Running npm test a second time (and any subsequent times) after install produces the correct result. However, running it from any kind of subshell (like Apache ant) will have it fail every single time.
  • Adding a devDependency to @unrs/resolver-binding-darwin-arm64 before npm install will make npm test run correctly immediately.

Environment

System:
    OS: macOS 15.5
    CPU: (12) arm64 Apple M2 Pro
  Binaries:
    Node: 20.19.1 - ~/.nvm/versions/node/v20.19.1/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.19.1/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v20.19.1/bin/npm
  npmPackages:
    jest: ^30.0.3 => 30.0.3

eavdmeer avatar Jul 07 '25 12:07 eavdmeer

Using the exact same code, on the same machine, but jest version 29 works:

rm -rf node_modules
npm install jest@29
nmp install
npm test

This outputs:

> [email protected] test
> jest --env node --passWithNoTests

 PASS  ./index.test.js
  add tester
    ✓ add two numbers (1 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        0.184 s, estimated 1 s
Ran all test suites.

eavdmeer avatar Jul 08 '25 06:07 eavdmeer

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Aug 07 '25 07:08 github-actions[bot]

I couldn't seem to reproduce the issue in even Jest v30.0.3, which is the presumably affected version.

I downloaded Apache Ant and run the npm test via its build config and it yielded success result.

Image

hainenber avatar Aug 24 '25 05:08 hainenber

From the repository I set up:

  "devDependencies": {
    "jest": "^30.0.4"
  }

Maybe talk to curbengh. He seems to have been able to reproduce. Are you using MacOS on Arm? I've seen this as recently as yesterday on a MacBook Pro M2 Sequoia 15.6.1

eavdmeer avatar Aug 24 '25 08:08 eavdmeer

@eavdmeer I have an Mac Silicon v2 on Sequoia 15.6.1 and even though I've retried with Jest 30.4 + 30.5, the test still succeeds.

hainenber avatar Aug 24 '25 08:08 hainenber

Do you by any chance have jest installed globally? This issue only happens the first time you run jest after a fresh install. If you have it installed globally, you'll never see the issue. Please check with npm ls -g

eavdmeer avatar Aug 24 '25 12:08 eavdmeer

No jest installed globally on my side. In fact, I changed the npm script to call the exact jest binary in project-wide node_modules

Image

hainenber avatar Aug 24 '25 13:08 hainenber

I get exactly the same issue in a linux debian PC

Without adding any other jest config, with version 29 everything is fine, but with v30

Image

Wils3B avatar Aug 30 '25 00:08 Wils3B

The issue seems to not always show up. I have a MacBook Air M3 that doesn't have the issue. However, I have confirmed that this still happens on my M2 Pro.

eavdmeer avatar Aug 30 '25 07:08 eavdmeer

● Validation Error:

  Module E:\some-folder\some-repo\node_modules\jest-circus\build\runner.js in the testRunner option was not found.
         <rootDir> is: E:\some-folder\some-repo

  Configuration Documentation:
  https://jestjs.io/docs/configuration

Facing this in windows 11 system with jest 30.1.3

AkshayKrJha avatar Sep 05 '25 09:09 AkshayKrJha

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Oct 06 '25 09:10 github-actions[bot]

Also still experiencing this issue, Windows 11, jest 30.1.3.

timosandberg avatar Oct 16 '25 06:10 timosandberg

@JounQin have you seen this issue before?

SimenB avatar Oct 16 '25 07:10 SimenB

@JounQin have you seen this issue before?

Sorry I didn't notice this issue, I'll take a look at the reproduction while the native binding should be installed automatically via napi-postinstall.

@timosandberg What npm version are you using?

JounQin avatar Oct 16 '25 07:10 JounQin

@timosandberg What npm version are you using?

I was using 10.9.2, now upgraded to latest (11.6.2) but the issue remains.

timosandberg avatar Oct 16 '25 08:10 timosandberg

@timosandberg Can you check your node_modules structure? Is node_modules/@unrs/resolver-binding-* package installed correctly there?

JounQin avatar Oct 16 '25 13:10 JounQin

@timosandberg Can you check your node_modules structure? Is node_modules/@unrs/resolver-binding-* package installed correctly there?

Yes, there's resolver-binding-win32-x64-msvc 1.11.1 installed.

timosandberg avatar Oct 16 '25 13:10 timosandberg

Got the following error on MacOS 15.6.1 with jest 30, npm v8.11.0, node v17.9.1; downgrading to jest 29 clears the error:

● Validation Error:

  Module /Users/.../node_modules/jest-jasmine2/build/index.js in the testRunner option was not found.
         <rootDir> is: /Users/...

jgoachermedable avatar Nov 07 '25 11:11 jgoachermedable