Skip to content

Specify that spec reporter is a class and needs to be instantiate for usage with run #48112

Closed
@sushantdhiman

Description

@sushantdhiman

Affected URL(s)

https://nodejs.org/api/test.html#test-reporters

Description of the problem

When importing spec test reporter, you need to instantiate it otherwise you will get no output, for example

import { run } from "node:test";
import { tap, spec } from "node:test/reporters";
import { resolve } from "path";

const files = [resolve("./test/test.js")];

run({
  files,
  concurrency: 1,
  timeout: 10000,
})
 --- .compose(spec)
+++.compose(new spec())
  .pipe(process.stdout);

Documentation should indicate that spec reporter is exported as a class unlike tap and dot reporters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.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