diff --git a/doc/api/test.md b/doc/api/test.md index cbfc9db94bb..312f9c27eaa 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -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 `.`, @@ -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 @@ -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 diff --git a/lib/internal/test_runner/utils.js b/lib/internal/test_runner/utils.js index 7f78bddf4be..0d6fab11d10 100644 --- a/lib/internal/test_runner/utils.js +++ b/lib/internal/test_runner/utils.js @@ -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) { diff --git a/test/parallel/test-runner-reporters.js b/test/parallel/test-runner-reporters.js index a412bd099ec..f3adae7ab6d 100644 --- a/test/parallel/test-runner-reporters.js +++ b/test/parallel/test-runner-reporters.js @@ -16,10 +16,10 @@ describe('node:test reporters', { concurrency: true }, () => { it('should default to outputing TAP to stdout', async () => { const child = spawnSync(process.execPath, ['--test', testFile]); assert.strictEqual(child.stderr.toString(), ''); - assert.match(child.stdout.toString(), /TAP version 13/); - assert.match(child.stdout.toString(), /ok 1 - ok/); - assert.match(child.stdout.toString(), /not ok 2 - failing/); - assert.match(child.stdout.toString(), /ok 2 - top level/); + assert.match(child.stdout.toString(), /✖ failing tests:/); + assert.match(child.stdout.toString(), /✔ ok/); + assert.match(child.stdout.toString(), /✖ failing/); + assert.match(child.stdout.toString(), /✔ top level/); }); it('should default destination to stdout when passing a single reporter', async () => {