Skip to content

--test-name-pattern not working for async describe suites #54084

@rstagi

Description

@rstagi

Version

v22.5.1

Platform

Darwin Kernel Version 23.4.0

Subsystem

test runner

What steps will reproduce the bug?

With a suite like the following:

// test.mjs
import { describe, test } from "node:test";

describe("async describe", async (t) => {
  await test("some test");
});

describe("sync describe", () => {
  test("some test");
});

Run the tests with --test-name-pattern="some test":

$ node --test-name-pattern="some test" test.mjs
▶ sync describe
  ✔ some test (0.362916ms)
▶ sync describe (1.022417ms)
ℹ tests 1
ℹ suites 1
ℹ pass 1
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 6.460416

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

always

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

I would expect both the test suites async describe and sync describe to work.

What do you see instead?

Only the sync describe suite seem to be working.

Additional information

By running the tests without any test name pattern, they all get executed:

$ node test.mjs
▶ async describe
  ✔ some test (0.477375ms)
▶ async describe (1.367375ms)
▶ sync describe
  ✔ some test (0.066833ms)
▶ sync describe (0.200708ms)
ℹ tests 2
ℹ suites 2
ℹ pass 2
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 7.35

Metadata

Metadata

Assignees

No one assigned

    Labels

    test_runnerIssues and PRs related to the test runner subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions