Open
Description
Version
29.7.0
Steps to reproduce
- Clone https://github.com/TWiStErRob/repros/tree/main/jest/v8-flaky-coverage
npm install
npm test -- --runInBand wrapped.test.js
-> tests pass, coverage 100%npm test -- --runInBand
-> tests pass, coverage missing lines
Expected behavior
Everything passes and coverage is better or equivalent to when only a single test is executed.

Actual behavior
File that is covered by a single test file to 100% loses coverage when an additional test is executed. The additional test calls the original function.

Additional context
Anything relevant changed in the repro will make it work correctly. So:
v8
->babel
✅- changing the order of execution of tests (sorted.js
<
->>
) ✅
We used atestSequencer
to consistently reproduce the issue, otherwise it was flaky! - changing the order via removing
--runInBand
✅
We also used this to consistently reproduce the issue, otherwise it was flaky!
Environment
System:
OS: macOS 14.1.2
CPU: (12) arm64 Apple M2 Pro or (10) arm64 Apple M1 Pro
Binaries:
Node: 20.10.0 - /opt/homebrew/opt/node@20/bin/node
npm: 10.2.3 - /opt/homebrew/opt/node@20/bin/npm
npmPackages:
jest: ^29.7.0 => 29.7.0
Also on github actions ubuntu-latest (so Ubuntu 22.04 and x64).