#4639·ts-jest

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

Author: thomasballingerCreated Nov 26, 2024Updated Mar 12, 2026
LabelsBug ReportNeeds Triage

Version

29.2.5

Steps to reproduce

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

bash
git clone [email protected]: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

bash
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