jestjs / jest

Delightful JavaScript Testing.
https://jestjs.io
MIT License
44.13k stars 6.44k forks source link

[Bug]: Tests passes in CI/docker, but fails locally, unless `console.log` is used #14721

Closed chrisvltn closed 8 months ago

chrisvltn commented 10 months ago

Version

29.7.0

Steps to reproduce

  1. Clone my repo: git clone https://github.com/chrisvltn/jest-inconsistent-failure.git
  2. Run npm install
  3. Run npm run test

Expected behavior

Both tests pass

Actual behavior

Test with console.log passes, but test without console.log fails.

Additional context

When running the same tests in docker (docker run --rm -it -v $(pwd):/app --platform=linux/amd64 -w /app node:18.18.2 npm run test), both tests pass.

Running with --runInBand had the same behavior. SWC and ts-jest transformers had the same behavior.

The tests are executed in Overlay and SideDrawerOverlay, which have the same code internally. If they run in only one of them, they pass.

This was noticed as it was often failing on local, but passing in our pipelines (which use Docker under the hood as well)

Environment

System:
    OS: macOS 14.0
    CPU: (10) arm64 Apple M1 Max
Binaries:
    Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
    npm: 9.8.1 - ~/.nvm/versions/node/v18.18.2/bin/npm
    pnpm: 8.10.5 - ~/.nvm/versions/node/v18.18.2/bin/pnpm
npmPackages:
    jest: 29.7.0 => 29.7.0
github-actions[bot] commented 9 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] commented 8 months ago

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

github-actions[bot] commented 8 months ago

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

github-actions[bot] commented 7 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.