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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

test.concurrent() code is executed when inside a describe.skip() block #11248

Closed
paulbrimicombe opened this issue Mar 29, 2021 · 4 comments 路 Fixed by #12748
Closed

test.concurrent() code is executed when inside a describe.skip() block #11248

paulbrimicombe opened this issue Mar 29, 2021 · 4 comments 路 Fixed by #12748

Comments

@paulbrimicombe
Copy link

馃悰 Bug Report

  • test.concurrent() appears to run any synchronous code in the test function when nested inside a describe.skip() block.
  • This code is not run for it() nested inside a describe.skip() block.
  • This code is not run for test.concurrent.skip().
  • This can be particularly problematic in integration tests where some functions can have side effects.

To Reproduce

A small example to reproduce:

describe.skip("When in a describe.skip() block", () => {
  it.concurrent("it.concurrent() code should not run", async () => {
    console.log("This (concurrent) line should never be run");
    await new Promise((resolve) => setTimeout(resolve, 0));
    console.log("This async (concurrent) line should never be run");
    fail();
  });

  it("it() code should not run", async () => {
    console.log("This (non-concurrent) line should never be run");
    fail();
  });
});

describe("When in a describe() block", () => {
  it.concurrent("it.concurrent() tests should be run", async () => {
    expect(true).toBe(true);
  });

  it("it() tests should be run", async () => {
    expect(true).toBe(true);
  });
});

The output of jest --verbose is:

Expected behavior

I would expect the behaviour of the following examples to be identical:

describe.skip("", () => {
  it("", async () => {});

  it.skip("", async () => {});
  
  it.concurrent("", async () => {});

  it.concurrent.skip("", async () => {});
});

it.skip("", async () => {});

it.concurrent.skip("", async () => {});

Link to repl or repo (highly encouraged)

The example above should be sufficient.

envinfo

  System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
  Binaries:
    Node: 14.15.0 - ~/.nvm/versions/node/v14.15.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.8 - ~/.nvm/versions/node/v14.15.0/bin/npm
  npmPackages:
    jest: ^26.6.3 => 26.6.3 
@fregin
Copy link

fregin commented May 26, 2021

Same problem
But test.concurrent.skip also runs

@paulbrimicombe
Copy link
Author

Thanks @SimenB .

@SimenB
Copy link
Member

SimenB commented Apr 26, 2022

Thank @dmitri-gb! 馃榾

@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 May 27, 2022
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.

3 participants