jest icon indicating copy to clipboard operation
jest copied to clipboard

[Bug]: `assertion` failed when executing tests use `test.concurrent(...)`

Open nieyuyao opened this issue 3 years ago • 5 comments

Version

v27.0.0

Steps to reproduce

https://stackblitz.com/edit/jest-cocurrent-test

Expected behavior

I expect the test1 should be passed, the assertionCalls should be 3.

Actual behavior

The test1 fails with the following error,

 FAIL  ./assertion.test.ts
  ✕ test1 (35 ms)
  ✓ test2 (57 ms)

  ● test1

    expect.assertions(1)

    Expected one assertion to be called but received three assertion calls.

      19 |
      20 | test.concurrent('test2', async () => {
    > 21 |   expect.assertions(1);
         |          ^
      22 |   await delay(100).then(() => {
      23 |     expect(2).toEqual(2);
      24 |   });

      at Object.<anonymous> (assertion.test.ts:21:10)
      at assertion.test.ts:7:71
      at Object.<anonymous>.__awaiter (assertion.test.ts:3:12)
      at assertion.test.ts:20:37
      at node_modules/throat/index.js:11:20
      at run (node_modules/throat/index.js:10:14)
      at node_modules/throat/index.js:70:12

Additional context

None

Environment

System:
    OS: Linux 5.0 undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.10 - /bin/yarn
    npm: 7.17.0 - /bin/npm
  npmPackages:
    jest: ^27.0.0 => 27.0.0

nieyuyao avatar Jun 05 '22 02:06 nieyuyao

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 Jul 05 '22 02:07 github-actions[bot]

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 14 '22 13:08 github-actions[bot]

Commenting to keep this alive.

davecardwell avatar Aug 17 '22 22:08 davecardwell

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

Commenting to keep this alive. Still an issue in Jest v29.0.3.

davecardwell avatar Sep 18 '22 18:09 davecardwell

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

Commenting to keep this issue open.

davecardwell avatar Oct 18 '22 18:10 davecardwell

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 Nov 17 '22 18:11 github-actions[bot]

This is still an issue.

davecardwell avatar Nov 21 '22 13:11 davecardwell

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 Dec 21 '22 13:12 github-actions[bot]

Bump

davecardwell avatar Jan 01 '23 16:01 davecardwell

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 Jan 31 '23 17:01 github-actions[bot]

It's an issue for me too. I solved it by removing the concurrency.

FadhiliNjagi avatar Mar 01 '23 07:03 FadhiliNjagi

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 Mar 31 '23 10:03 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 Apr 30 '23 11:04 github-actions[bot]

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 May 31 '23 00:05 github-actions[bot]