Skip to content

test.concurrent ignores beforeEach and afterEach #7997

@sibyldawn

Description

@sibyldawn

🐛 Bug Report

When using test.concurrent with tests, all the scenarios run first and then the beforeEach and afterEach blocks run next.

To Reproduce

Write a simple test suite with a beforeEach , 3 tests using test.concurrent, and afterEach.

Expected behavior

I expect runner to execute beforeEach block, then the test, then afterEach block.

Link to repl or repo (highly encouraged)

test-concurrent bug demo

Issues without a reproduction link are likely to stall.

Run npx envinfo --preset jest

Paste the results here:

Jest v22.1.2 node v7.4.0 linux/amd64
   
 PASS  ./concurrent-test.js
  try running parallel by scenario level
    ✓ First Test (3ms)
    ✓ Second Test
    ✓ Third Test (1ms)

  console.log concurrent-test.js:8
    Test 1

  console.log concurrent-test.js:12
    Test 2

  console.log concurrent-test.js:16
    Test 3

  console.log concurrent-test.js:4
    BEFORE

  console.log concurrent-test.js:20
    AFTER

  console.log concurrent-test.js:4
    BEFORE

  console.log concurrent-test.js:20
    AFTER

  console.log concurrent-test.js:4
    BEFORE

  console.log concurrent-test.js:20
    AFTER

Test Suites: 1 passed, 1 total
Tests:       3 passed, 3 total
Snapshots:   0 total
Time:        0.993s, estimated 1s
Ran all test suites.
   

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