jest icon indicating copy to clipboard operation
jest copied to clipboard

[Bug]: default jest config will sometimes result in shards with 0 tests

Open jazzdan opened this issue 2 years ago • 7 comments

Version

28.1.3

Steps to reproduce

  1. git clone [email protected]:jazzdan/jest-shard-bug.git
  2. cd jest-shard-bug
  3. yarn install
  4. yarn reproduce

Expected behavior

I would expect the 12/12 shards to contain at least 1 test, ideally 4. There are 55 tests and 12 shards. I would expect each shard to contain at least 4 tests since 55/12 = 4 and some change.

Actual behavior

Instead the 12th shard contains 0 tests, which is an error by default in jest.

I know I can implement my own test sequencer but it was surprising to me that using the default sequencer with a default jest config and shards could result in an error.

Additional context

No response

Environment

System:
    OS: macOS 12.4
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
  npmPackages:
    jest: ^28.1.3 => 28.1.3

jazzdan avatar Jul 14 '22 18:07 jazzdan

can i work on this issue?

rahul3002 avatar Jul 15 '22 04:07 rahul3002

Here's a replay of the issue, for what it's worth https://app.replay.io/recording/jest-shards-can-sometimes-have-0-tests-in-them--03c102a9-23de-4dff-9703-33c21e3103bc?point=649037107455789718243409532026952&time=1478.2236363636364&hasFrames=true

jazzdan avatar Jul 19 '22 18:07 jazzdan

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] avatar Aug 18 '22 18:08 github-actions[bot]

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] avatar Sep 17 '22 18:09 github-actions[bot]

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] avatar Sep 17 '22 18:09 github-actions[bot]

/reopen

rahul3002 avatar Sep 18 '22 10:09 rahul3002

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] avatar Oct 19 '22 07:10 github-actions[bot]

@rahul3002 are you still up for sending a PR?

/cc @marionebl FYI

SimenB avatar Oct 19 '22 07:10 SimenB

https://github.com/facebook/jest/releases/tag/v29.2.2

SimenB avatar Oct 24 '22 20:10 SimenB

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.

github-actions[bot] avatar Nov 24 '22 00:11 github-actions[bot]