-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
Closed
Labels
test_runnerIssues and PRs related to the test runner subsystem.Issues and PRs related to the test runner subsystem.
Description
Version
v20.4.0
Platform
Darwin lucille.lan 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:23 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6020 arm64
Subsystem
test runner
What steps will reproduce the bug?
If you run this test with node --test
, "before" is not printed.
import { describe, it, before, after } from "node:test";
before(async () => {
console.log("before");
});
after(async () => {
console.log("after");
});
describe("describe", async () => {
it("it inside describe", async () => {});
});
If you define a test outside the describe, "before" is printed
import { describe, it, before, after } from "node:test";
before(async () => {
console.log("before");
});
after(async () => {
console.log("after");
});
describe("describe", async () => {
it("it inside describe", async () => {});
});
it("it outside describe", async () => {});
How often does it reproduce? Is there a required condition?
It's deterministic.
What is the expected behavior? Why is that the expected behavior?
The before hook should always run.
What do you see instead?
It only runs if I have a global test.
Additional information
after
doesn't seem to be affected by this issue. It always runs. This makes me believe that the intended behavior of before
matches my expectations.
Metadata
Metadata
Assignees
Labels
test_runnerIssues and PRs related to the test runner subsystem.Issues and PRs related to the test runner subsystem.