Skip to content

Programmatically using the spec reporter from node:test/reporters doesn't output anything. #48585

Closed as not planned
@nohehf

Description

Version

v20.3.0

Platform

Darwin mbp-nohehf.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000 arm64

Subsystem

No response

What steps will reproduce the bug?

Having the following minimal reproduction files:

// index.js
import { run } from "node:test";
import process from "node:process";
import { spec } from "node:test/reporters";

run({
  files: ["./test.js"],
})
  .compose(spec)
  .pipe(process.stdout);
// test.js
import { it } from "node:test";
import assert from "node:assert";

it("should work", () => {
  assert.equal(1, 1);
});

Running test.js file via the cli using node --test test.js outputs (as expected):
image

Running test.js file programmatically via index.js, using node index.js outputs nothing and exits with status code 1.
image

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

No response

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

Using spec reporter should work programmatically, as tap reporter does.

What do you see instead?

Using spec reporter programmatically outputs nothing and exits with status code 1.

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    duplicateIssues and PRs that are duplicates of other issues or PRs.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