question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: `test.concurrent.each` not executing tests concurrently

See original GitHub issue

Version

v27.3.1

Steps to reproduce

import { setTimeout } from 'timers/promises';

test.concurrent.each([1, 2, 3, 4, 5])(
  'concurrency test',
  async () => {
    await setTimeout(1000);
    expect(true).toBe(true);
  },
);
 PASS  src/a.spec.ts (5.457 s)
  ✓ concurrency test (1004 ms)
  ✓ concurrency test (1001 ms)
  ✓ concurrency test (1002 ms)
  ✓ concurrency test (1002 ms)
  ✓ concurrency test (1000 ms)

Test Suites: 1 passed, 1 total
Tests:       5 passed, 5 total
Snapshots:   0 total
Time:        5.653 s, estimated 6 s

Expected behavior

I expect test run time to be around 1 second

Actual behavior

Based on the run time tests seem to be run in sync.

Additional context

No response

Environment

System:
    OS: Linux 4.19 Ubuntu 20.04.3 LTS (Focal Fossa)
    CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
  npmPackages:
    jest: ^27.3.1 => 27.3.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Mark1626commented, Dec 22, 2021

It seems to be in jest-circus after version v27.0.0.

It works fine for me with jest-jasmine2 in v27.0.0.

Can another person try this with jest-jasmine2, to confirm it’s only in jest-circus?

// jest.config.js
{
  "testRunner": "jest-jasmine2"
}

With jest-jasmine:

 PASS  ./each.test.js
  ✓ concurrency test (998 ms)
  ✓ concurrency test
  ✓ concurrency test
  ✓ concurrency test (1 ms)
  ✓ concurrency test

Test Suites: 1 passed, 1 total
Tests:       5 passed, 5 total
Snapshots:   0 total
Time:        1.279 s, estimated 6 s
0reactions
github-actions[bot]commented, May 27, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Run Nightwatch tests in parallel | Developer Guide
Test concurrency is done at the file level. Each test file will fill a test worker slot. Individual tests/steps in a test file...
Read more >
JUnit 5 User Guide
With parallel execution enabled, run longer tests first: "shortest test plan execution duration" mode. Various other use cases.
Read more >
Are tests inside one file run in parallel in Jest? - Stack Overflow
By the way @trusktr Jest DOES run tests in parallel, just not ones in the same file. So you can run into issues...
Read more >
Run all tests in TestSuite array in parallel - MATLAB
When you select a test suite to run in parallel, consider possible resource contention. For example, if your test fixtures access global resources,...
Read more >
Why executing multiple tests in parallel is a bad idea | by Colin ...
Take QA manual testing as the use case to explore. Yes, you can execute multiple test cases at the same time. It appears...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found