Skip to content

Test runner: top-level diagnostics are ommited when running with --test#45910

@MoLow

Description

@MoLow

Version

v20.0.0-pre

Platform

Darwin Moshes-MBP.localdomain 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:01 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T6000 arm64

Subsystem

test_runner

What steps will reproduce the bug?

run node --test test.js
where tets.js is

consttest=require('node:test');test(()=>setImmediate(()=>done()));

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

always

What is the expected behavior?

the same as when running without --test:

TAP version 13 # Subtest: <anonymous> ok 1 - <anonymous> --- duration_ms: 2.272166 ... 1..1 # Warning: Test "<anonymous>" generated asynchronous activity after the test ended. This activity created the error "ReferenceError: done is not defined" and would have caused the test to fail, but instead triggered an uncaughtException event. # tests 1 # pass 1 # fail 0 # cancelled 0 # skipped 0 # todo 0 # duration_ms 5.046833 

What do you see instead?

TAP version 13 # Subtest: /Users/moshe/repos/node/a.js # Subtest: <anonymous> ok 1 - <anonymous> --- duration_ms: 2.224708 ... 1..1 not ok 1 - /Users/moshe/repos/node/a.js --- duration_ms: 81.555291 failureType: 'subtestsFailed' exitCode: 1 error: 'test failed' code: 'ERR_TEST_FAILURE' ... 1..1 # tests 1 # pass 0 # fail 1 # cancelled 0 # skipped 0 # todo 0 # duration_ms 82.435834 

missing # Warning: Test "<anonymous>" generated asynchronous activity after the test ended. This activity created the error "ReferenceError: done is not defined" and would have caused the test to fail, but instead triggered an uncaughtException event.

Additional information

diagnostics were ignored intentionally so the duration_ms, tests, pass etc don't appear twice:

if(nesting===1){
// Ignore file top level diagnostics
break;
}

we should find some way to filter top-level diagnostics only in cases they are redundant

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueIssues that are suitable for first-time contributors.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