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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_runner execute tests twice on v21 #50922

Closed
PierreDemailly opened this issue Nov 26, 2023 · 2 comments
Closed

test_runner execute tests twice on v21 #50922

PierreDemailly opened this issue Nov 26, 2023 · 2 comments

Comments

@PierreDemailly
Copy link

PierreDemailly commented Nov 26, 2023

Version

21.2.0

Platform

Microsoft Windows NT 10.0.19045.0 x64

Subsystem

test_runner

What steps will reproduce the bug?

Create a /test/foo.test.js file:

import assert from "node:assert";
import { describe, it } from "node:test";

describe("A", () => {
  it("A1", () => {
    assert.strictEqual(1, 1);
  });

  it("A2", () => {
    assert.strictEqual(1, 1);
  });
});

describe("B", () => {
  it("B1", () => {
    assert.strictEqual(1, 1);
  });

  it("B2", () => {
    assert.strictEqual(1, 1);
  });
});

Run node --test

How often does it reproduce? Is there a required condition?

Always.

What is the expected behavior? Why is that the expected behavior?

I expect each suite to be executed one time.

What do you see instead?

Each suite is execute twice.

Additional information

I wondered if it was related to number of describe, i've tried with this code:

describe("A", () => {
  it("A1", () => {
    assert.strictEqual(1, 1);
  });

  it("A2", () => {
    assert.strictEqual(1, 1);
  });
});

describe("B", () => {
  it("B1", () => {
    assert.strictEqual(1, 1);
  });

  it("B2", () => {
    assert.strictEqual(1, 1);
  });
});

describe("C", () => {
  it("C1", () => {
    assert.strictEqual(1, 1);
  });

  it("C2", () => {
    assert.strictEqual(1, 1);
  });
});

It's still execute each tests twice.

@meyfa
Copy link
Contributor

meyfa commented Nov 26, 2023

Sounds like a duplicate of #50875, which has been fixed and should be released soon.

@PierreDemailly
Copy link
Author

Alright, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants