Skip to content

[Bug]: Preset modules path not working on Windows in version ^30.2.0 #15960

@tomclague

Description

@tomclague

Version

30.2.0

Steps to reproduce

Previously our project had v29.7.0 version dev dependencies:
"jest": "^29.7.0",
"jest-cli": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",

running 'npm test' in either windows or mac machines worked.

We then upgraded to version 30 dev dependencies:
"jest": "^30.2.0",
"jest-cli": "^30.2.0",
"jest-environment-jsdom": "^30.2.0",

running 'npm test' on mac works. Windows gives error:

● Validation Error:

Preset ts-jest not found relative to rootDir C:\workspace\able-react.

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

Expected behavior

On Windows, I expect npm test to detect the ts-jest preset and run, as it does on mac

Actual behavior

Windows gives error on npm test:

● Validation Error:

Preset ts-jest not found relative to rootDir C:\workspace\able-react.

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

Additional context

The package (ts-jest) is installed at C:\workspace\able-react\node_modules.

I have tried numerous contortions of configuring rootDir property. This shouldn't be necessary, as both the package.json and jest.config.js are in the C:\workspace\able-react it detects as default.

Possible this issue relates to #15511

Environment

System:
    OS: Windows 11 10.0.26200
    CPU: (16) x64 Intel(R) Core(TM) Ultra 7 265H
  Binaries:
    Node: 22.14.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    jest: ^30.2.0 => 30.2.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions