jestjs/jest

jest.retryTimes fails when used along with test.concurrent

juliosampaio opened this issue ยท 3 comments

๐Ÿ› Bug Report

Using jest.concurrent along with jest.retryTimes makes the test not to be executed again when it fails.

To Reproduce

Steps to reproduce the behavior:

let CONCURRENT_RETRIES_COUNT = 0; //Just for the sake of this test! We know we shouldn't rely on globals within concurrent behavior
let SEQUENTIAL_RETRIES_COUNT = 0;
const RETRY_TIMES = 5;

jest.retryTimes(RETRY_TIMES);

describe('concurrent retry', () => {
  //the test bellow fails
  it.concurrent(`CONCURRENT_RETRIES_COUNT should be ${RETRY_TIMES}`, () => {
    CONCURRENT_RETRIES_COUNT += 1;
    // console.log(CONCURRENT_RETRIES_COUNT); // just prints once
    expect(CONCURRENT_RETRIES_COUNT).toBe(RETRY_TIMES);
  });
  //the test bellow passes
  it(`SEQUENTIAL_RETRIES_COUNT should be ${RETRY_TIMES}`, () => {
    // console.log(SEQUENTIAL_RETRIES_COUNT); // prints 5 times
    SEQUENTIAL_RETRIES_COUNT += 1;
    expect(SEQUENTIAL_RETRIES_COUNT).toBe(RETRY_TIMES);
  });
});

Expected behavior

The test should be executed again as many as times set with jest.retryTimes(RETRY_TIMES) when it fails;

Link to repl or repo (highly encouraged)

https://github.com/juliosampaio/jest-concurrent-retries-issue

envinfo

  System:
    OS: Linux 5.3 Linux Mint 19.2 (Tina)
    CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
  Binaries:
    Node: 10.15.0 - ~/.nvm/versions/node/v10.15.0/bin/node
    Yarn: 1.21.1 - /usr/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.15.0/bin/npm
  npmPackages:
    jest: ^26.4.2 => 26.4.2 

This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

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.