Skip to content

Commit 031aba5

Browse files
committed
test_runner: always make spec the default reporter
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: #54540
1 parent efd6176 commit 031aba5

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

doc/api/test.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,12 +1000,13 @@ flags for the test runner to use a specific reporter.
10001000

10011001
The following built-reporters are supported:
10021002

1003+
* `spec`
1004+
The `spec` reporter outputs the test results in a human-readable format. This
1005+
is the default reporter.
1006+
10031007
* `tap`
10041008
The `tap` reporter outputs the test results in the [TAP][] format.
10051009

1006-
* `spec`
1007-
The `spec` reporter outputs the test results in a human-readable format.
1008-
10091010
* `dot`
10101011
The `dot` reporter outputs the test results in a compact format,
10111012
where each passing test is represented by a `.`,
@@ -1018,9 +1019,6 @@ The following built-reporters are supported:
10181019
The `lcov` reporter outputs test coverage when used with the
10191020
[`--experimental-test-coverage`][] flag.
10201021

1021-
When `stdout` is a [TTY][], the `spec` reporter is used by default.
1022-
Otherwise, the `tap` reporter is used by default.
1023-
10241022
The exact output of these reporters is subject to change between versions of
10251023
Node.js, and should not be relied on programmatically. If programmatic access
10261024
to the test runner's output is required, use the events emitted by the
@@ -3505,7 +3503,6 @@ added:
35053503
Can be used to abort test subtasks when the test has been aborted.
35063504

35073505
[TAP]: https://testanything.org/
3508-
[TTY]: tty.md
35093506
[`--experimental-test-coverage`]: cli.md#--experimental-test-coverage
35103507
[`--experimental-test-snapshots`]: cli.md#--experimental-test-snapshots
35113508
[`--import`]: cli.md#--importmodule

lib/internal/test_runner/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const kBuiltinReporters = new SafeMap([
119119
['lcov', 'internal/test_runner/reporter/lcov'],
120120
]);
121121

122-
const kDefaultReporter = process.stdout.isTTY ? 'spec' : 'tap';
122+
const kDefaultReporter = 'spec';
123123
const kDefaultDestination = 'stdout';
124124

125125
function tryBuiltinReporter(name) {

0 commit comments

Comments
 (0)