Skip to content

test runner run() ignores testNamePatterns and testSkipPatterns when isolation is "none" #57399

Open
@galdebert

Description

@galdebert

Version

v22.14.0, v23.8.0

Platform

Microsoft Windows NT 10.0.19045.0 x64

Subsystem

test

What steps will reproduce the bug?

mytest.test.mjs

import { test } from "node:test";

test("a1", (t) => {
  console.log(t.name);
});

test("a2", (t) => {
  console.log(t.name);
});

test("b1", (t) => {
  console.log(t.name);
});

run.mjs

import * as test from "node:test";
import { spec } from "node:test/reporters";

test
  .run({
    globPatterns: ["mytest.test.mjs"],
    testNamePatterns: ["a"],
    testSkipPatterns: ["a2"],
    isolation: "none",
  })
  .compose(spec)
  .pipe(process.stdout);

output

a1
a2
b1
✔ a1 (1.1461ms)
✔ a2 (0.2373ms)
✔ b1 (0.2315ms)

that is incorrect, only a1 should run.

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

always

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

expected behavior is to run only a1

a1
✔ a1 (1.1336ms)

because

  • a2 should be skipped by testSkipPatterns: ["a2"]
  • b1 should be discarded by testNamePatterns: ["a"]

What do you see instead?

a1
a2
b1
✔ a1 (1.1461ms)
✔ a2 (0.2373ms)
✔ b1 (0.2315ms)

Additional information

Using isolation: "process" has the expected behavior

repor code: https://github.com/galdebert/repro-bug-node-test-runner

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