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

Test.Concurrent Causing False Negatives When One Test Throws an Error #11231

Closed
NC-choppk opened this issue Mar 23, 2021 · 2 comments · Fixed by #11987
Closed

Test.Concurrent Causing False Negatives When One Test Throws an Error #11231

NC-choppk opened this issue Mar 23, 2021 · 2 comments · Fixed by #11987

Comments

@NC-choppk
Copy link

🐛 Bug Report

When running tests using test.concurrent if a test rejects with an error while another is still in progress, the in progress is reported as failing even if it is passing.

To Reproduce

const tests = [
  500,
  10,
  11,
  12,
  13,
  14,
  15
];

describe('incorrect failures', () => {
  test.concurrent.each(tests)('%i', async (timeoutLength) => {
    await new Promise((resolve, reject) => {
      setTimeout(() => {
        if (timeoutLength === 14) {
          reject('Failure');
        }
        resolve();
      }, timeoutLength);
    });
  });
});

Ran with jest --maxConcurrency=4

I find that the 500 test and the 14 test both fail.

Expected behavior

Only the 14 test should fail.

Link to repl or repo (highly encouraged)

https://replit.com/talk/share/Jest-Concurrency-Bug/130501

envinfo

  System:
    OS: macOS 10.15.7
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 12.18.2 - ~/.nvm/versions/node/v12.18.2/bin/node
    npm: 6.14.5 - ~/.nvm/versions/node/v12.18.2/bin/npm
  npmPackages:
    jest: ^26.6.3 => 26.6.3
@gergo-seedcx
Copy link

We have also encountered the issue, @dmitri-gb 's fix solves it for us. Thank you guys!

@github-actions
Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators Dec 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants