mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
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: https://github.com/nodejs/node/issues/54540 PR-URL: https://github.com/nodejs/node/pull/54548 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
This commit is contained in:
parent
ba07067b92
commit
eb7e18fe94
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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 () => {
|
||||
|
Loading…
Reference in New Issue
Block a user