kulshekhar / ts-jest

A Jest transformer with source map support that lets you use Jest to test projects written in TypeScript.
https://kulshekhar.github.io/ts-jest
MIT License
6.98k stars 455 forks source link

[Bug]: Module resolution for custom condition fails if no cache available #4639

Open thomasballinger opened 4 days ago

thomasballinger commented 4 days ago

Version

29.2.5

Steps to reproduce

See repro at https://github.com/thomasballinger/ts-jest-repro

git clone git@github.com:thomasballinger/ts-jest-repro.git
cd ts-jest-repro/packages/tests
npm i
npx jest # should fail
npx jest # should succeed the second time
npx jest --no-cache # should fail again

Expected behavior

I expect --no-cache to behave the same as without the flag. I'd like this custom condition to resolve, so I'd like this test to pass.

Actual behavior

The custom condition appears not to be followed for package if --no-cache is used, or if it's the first run.

Debug log

ts-jest.log

Additional context

No response

Environment

System:
    OS: macOS 15.1.1
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 18.18.0 - ~/.nvm/versions/node/v18.18.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.8.1 - ~/.nvm/versions/node/v18.18.0/bin/npm
    pnpm: 9.10.0 - ~/.nvm/versions/node/v18.18.0/bin/pnpm
    bun: 1.1.36 - ~/.bun/bin/bun
  npmPackages:
    jest: ^29.7.0 => 29.7.0
thomasballinger commented 4 days ago

I originally thought this was CI thing (because the cache is never populated there!)