diff --git a/test/parallel/test-runner-subtest-after-hook.js b/test/parallel/test-runner-subtest-after-hook.js new file mode 100644 index 00000000000000..f288abee243de2 --- /dev/null +++ b/test/parallel/test-runner-subtest-after-hook.js @@ -0,0 +1,12 @@ +'use strict'; +const common = require('../common'); +const { test } = require('node:test'); + +// Regression test for https://github.com/nodejs/node/issues/51997 +test('after hook should be called with no subtests', (t) => { + const timer = setTimeout(common.mustNotCall(), 2 ** 30); + + t.after(common.mustCall(() => { + clearTimeout(timer); + })); +});