mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
3d5357a2f4
This commit updates the test runner tests in order to switch the default reporter from tap to spec. This commit can be backported, while changing the default reporter cannot. Refs: https://github.com/nodejs/node/issues/54540 PR-URL: https://github.com/nodejs/node/pull/54547 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
27 lines
874 B
JavaScript
27 lines
874 B
JavaScript
'use strict';
|
|
const { spawnPromisified } = require('../common');
|
|
const fixtures = require('../common/fixtures');
|
|
const { strictEqual } = require('node:assert');
|
|
const { test } = require('node:test');
|
|
|
|
test('root duration is longer than test duration', async () => {
|
|
const {
|
|
code,
|
|
stderr,
|
|
stdout,
|
|
} = await spawnPromisified(process.execPath, [
|
|
'--test-reporter=tap',
|
|
fixtures.path('test-runner/root-duration.mjs'),
|
|
]);
|
|
|
|
strictEqual(code, 0);
|
|
strictEqual(stderr, '');
|
|
const durations = [...stdout.matchAll(/duration_ms:? ([.\d]+)/g)];
|
|
strictEqual(durations.length, 2);
|
|
const testDuration = Number.parseFloat(durations[0][1]);
|
|
const rootDuration = Number.parseFloat(durations[1][1]);
|
|
strictEqual(Number.isNaN(testDuration), false);
|
|
strictEqual(Number.isNaN(rootDuration), false);
|
|
strictEqual(rootDuration >= testDuration, true);
|
|
});
|