node/test/fixtures/test-runner/output/force_exit.js
Colin Ihrig 84de97a61e
test_runner: support forced exit
This commit updates the test runner to allow a forced exit once
all known tests have finished running.

Fixes: https://github.com/nodejs/node/issues/49925
PR-URL: https://github.com/nodejs/node/pull/52038
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Raz Luvaton <rluvaton@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2024-03-13 10:49:15 +00:00

27 lines
493 B
JavaScript

// Flags: --test-force-exit --test-reporter=spec
'use strict';
const { after, afterEach, before, beforeEach, test } = require('node:test');
before(() => {
console.log('BEFORE');
});
beforeEach(() => {
console.log('BEFORE EACH');
});
after(() => {
console.log('AFTER');
});
afterEach(() => {
console.log('AFTER EACH');
});
test('passes but oops', () => {
setTimeout(() => {
throw new Error('this should not have a chance to be thrown');
}, 1000);
});
test('also passes');