Skip to content

Commit

Permalink
test_runner: always make spec the default reporter
Browse files Browse the repository at this point in the history
This is a breaking change. Prior to this commit, the test_runner
defaulted to the spec reporter if using a TTY, and the TAP
reporter otherwise. This commit makes spec the default reporter
unconditionally. TAP output is still available via the
--test-reporter=tap CLI flag.

Fixes: nodejs#54540
  • Loading branch information
cjihrig committed Aug 24, 2024
1 parent efd6176 commit 031aba5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions doc/api/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -1000,12 +1000,13 @@ flags for the test runner to use a specific reporter.

The following built-reporters are supported:

* `spec`
The `spec` reporter outputs the test results in a human-readable format. This
is the default reporter.

* `tap`
The `tap` reporter outputs the test results in the [TAP][] format.

* `spec`
The `spec` reporter outputs the test results in a human-readable format.

* `dot`
The `dot` reporter outputs the test results in a compact format,
where each passing test is represented by a `.`,
Expand All @@ -1018,9 +1019,6 @@ The following built-reporters are supported:
The `lcov` reporter outputs test coverage when used with the
[`--experimental-test-coverage`][] flag.

When `stdout` is a [TTY][], the `spec` reporter is used by default.
Otherwise, the `tap` reporter is used by default.

The exact output of these reporters is subject to change between versions of
Node.js, and should not be relied on programmatically. If programmatic access
to the test runner's output is required, use the events emitted by the
Expand Down Expand Up @@ -3505,7 +3503,6 @@ added:
Can be used to abort test subtasks when the test has been aborted.

[TAP]: https://testanything.org/
[TTY]: tty.md
[`--experimental-test-coverage`]: cli.md#--experimental-test-coverage
[`--experimental-test-snapshots`]: cli.md#--experimental-test-snapshots
[`--import`]: cli.md#--importmodule
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/test_runner/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const kBuiltinReporters = new SafeMap([
['lcov', 'internal/test_runner/reporter/lcov'],
]);

const kDefaultReporter = process.stdout.isTTY ? 'spec' : 'tap';
const kDefaultReporter = 'spec';
const kDefaultDestination = 'stdout';

function tryBuiltinReporter(name) {
Expand Down

0 comments on commit 031aba5

Please sign in to comment.