node/test/parallel/test-runner-force-exit-failure.js
Colin Ihrig 3d5357a2f4
test: refactor test_runner tests to change default reporter
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>
2024-08-27 00:54:22 +00:00

26 lines
768 B
JavaScript

'use strict';
require('../common');
const { match, doesNotMatch, strictEqual } = require('node:assert');
const { spawnSync } = require('node:child_process');
const fixtures = require('../common/fixtures');
const fixture = fixtures.path('test-runner/throws_sync_and_async.js');
for (const isolation of ['none', 'process']) {
const args = [
'--test',
'--test-reporter=spec',
'--test-force-exit',
`--experimental-test-isolation=${isolation}`,
fixture,
];
const r = spawnSync(process.execPath, args);
strictEqual(r.status, 1);
strictEqual(r.signal, null);
strictEqual(r.stderr.toString(), '');
const stdout = r.stdout.toString();
match(stdout, /Error: fails/);
doesNotMatch(stdout, /this should not have a chance to be thrown/);
}