Skip to content

after not failing the root test #48867

Closed
@rluvaton

Description

@rluvaton

Version

v21.0.0-pre (master)

Platform

No response

Subsystem

test_runner

What steps will reproduce the bug?

after not failing the test

const {it, after} = require("node:test");

after(() => {
  throw new Error('after')
});

it("it", function tes() {
});

this pass as well

after(() => {
  throw new Error('after')
});

describe('desc', () => {
  it("it", () => {
  });
});

if the after had process.exit(1) it would fail as the hook called but registering the error

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

always

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

the after should fail the tests

What do you see instead?

~/dev/open-source/node/node-fork/out/Release/node --test ./tmp.js
✔ it (0.772958ms)
ℹ tests 1
ℹ suites 0
ℹ pass 1
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 898.444625

Process finished with exit code 0

Additional information

it seems that the after does not report that it failed (The fail method does call for both the <root> and the hook)

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