Files
node/test/parallel/test-runner-aftereach-runtime-skip.js
Igor Shevelenkov 2ae6d8f2d6 test_runner: run afterEach on runtime skip
Signed-off-by: Igor <igorshevelenkov4@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/61525
Fixes: https://github.com/nodejs/node/issues/61462
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
2026-02-26 21:36:23 +00:00

37 lines
771 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('node:assert');
const { beforeEach, afterEach, test } = require('node:test');
let beforeEachTotal = 0;
let afterEachRuntimeSkip = 0;
let afterEachTotal = 0;
beforeEach(common.mustCall(() => {
beforeEachTotal++;
}, 2));
afterEach(common.mustCall((t) => {
afterEachTotal++;
if (t.name === 'runtime skip') {
afterEachRuntimeSkip++;
}
}, 2));
test('normal test', (t) => {
t.assert.ok(true);
});
test('runtime skip', (t) => {
t.skip('skip after setup');
});
test('static skip', { skip: true }, common.mustNotCall());
process.on('exit', () => {
assert.strictEqual(beforeEachTotal, 2);
assert.strictEqual(afterEachRuntimeSkip, 1);
assert.strictEqual(afterEachTotal, 2);
});