Skip to content

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

@NC-choppk

Description

@NC-choppk

🐛 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions