You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No error, Jest should recognise that package.json file of my-jest-preset defines exports for ./jest-preset.
Actual behavior
Jest fails to start the test run due to missing jest-preset.js file, but only on Windows machines.
Jest v29.7.0 error message:
> github-jest-preset-windows@1.0.0 test
> jest
● Validation Error:
Preset my-jest-preset not found.
Configuration Documentation:
https://jestjs.io/docs/configuration
Error: Process completed with exit code 1.
Jest v30.0.0-alpha.7 error message:
> github-jest-preset-windows@1.0.0 test
> jest
● Validation Error:
Preset my-jest-preset not found relative to rootDir D:\a\jest-preset-windows\jest-preset-windows.
Configuration Documentation:
https://jestjs.io/docs/configuration
Error: Process completed with exit code 1.
We ran into the same issue today. We have a mix of machine types across our development team and didn't notice the issue until we started rolling our presets out for broader use. Any fix or workaround would be greatly appreciated.
@jagiles-ren as a workaround, we added jest-preset.js file to the root of our npm package which gets picked up by windows machines. It just re-exports the preset file (and makes the exports definition pretty much useless 😅)
@Filipoliko - yeah we discovered the same thing. Jest on Windows appears to be ignoring exports and combining paths to resolve the reference to the preset file. We have a library that exports a number of different configuration objects and so we had the preset at a subdirectory within the lib/ directory. We noticed on windows if we added lib/ to our configured preset it worked (obviously ignoring the exports from the package.json).
Version
29.7.0
Steps to reproduce
npm ci
npm test
Expected behavior
No error, Jest should recognise that
package.json
file ofmy-jest-preset
definesexports
for./jest-preset
.Actual behavior
Jest fails to start the test run due to missing
jest-preset.js
file, but only on Windows machines.Jest v29.7.0 error message:
Jest v30.0.0-alpha.7 error message:
Additional context
See pipeline results https://github.com/Filipoliko/jest-preset-windows/actions/runs/13372503574 (v29), https://github.com/Filipoliko/jest-preset-windows/actions/runs/13372781509 (v30) - it shows that the same jest configuration works for Linux and MacOS, but fails for Windows.
The path to
jest-preset.js
file is defined viaexports
definition inpackage.json
- see https://github.com/Filipoliko/jest-preset-windows/blob/main/packages/my-jest-preset/package.json#L6Environment
The text was updated successfully, but these errors were encountered: