Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: expect.assertions fails when using test.concurrent #14263

Open
davecardwell opened this issue Jun 25, 2023 · 4 comments
Open

[Bug]: expect.assertions fails when using test.concurrent #14263

davecardwell opened this issue Jun 25, 2023 · 4 comments

Comments

@davecardwell
Copy link

Version

29.5.0

Steps to reproduce

  1. Clone my repo at https://github.com/davecardwell/jest-concurrent-assertion-repro
  2. npm install
  3. npm test
  4. You should see the error come up

Expected behavior

I expect the test suite to pass.

Actual behavior

The test suite fails with the error:

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

Both tests have expect.assertions(1).

Additional context

Remove the .concurrent or add .skip to either test and the test suite passes.

Environment

System:
    OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa)
    CPU: (2) x64 Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz
  Binaries:
    Node: 19.9.0 - ~/nvm/current/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 9.6.3 - ~/nvm/current/bin/npm
  npmPackages:
    jest: ^29.5.0 => 29.5.0
@davecardwell
Copy link
Author

This was previously reported at #12911 but automatically closed as stale. The issue persists in Jest v29.5.0.

@mrazauskas
Copy link
Contributor

@dmitri-gb Could you take a look, please? Perhaps this something what AsyncLocalStorage could help to solve as well? Just thought to ping you, because you are know the concurrent context (;

@SimenB
Copy link
Member

SimenB commented Jun 30, 2023

Yeah, ASL might be able to solve this as well

@PabloPollono-Nexplore
Copy link

do we have an update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants