Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/internal/test_runner/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ function stopTest(timeout, signal) {
disposeFunction = abortListener[SymbolDispose];
} else {
timer = setTimeout(() => deferred.resolve(), timeout);
timer.unref();

ObjectDefineProperty(deferred, 'promise', {
__proto__: null,
Expand Down
7 changes: 7 additions & 0 deletions test/fixtures/test-runner/output/timeout_ref.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';
const { test } = require('node:test');

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test('very long time out ref dosent freeze process', { timeout: 30 * 1e3 }, () => {});

test('callback test that times out', { timeout: 1 }, (t, done) => {});
test('promise test that times out', { timeout: 1 }, () => {
return new Promise(() => {});
});
28 changes: 28 additions & 0 deletions test/fixtures/test-runner/output/timeout_ref.snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
TAP version 13
# Subtest: callback test that times out
not ok 1 - callback test that times out
---
duration_ms: *
location: '/test/fixtures/test-runner/output/timeout_ref.js:(LINE):1'
failureType: 'testTimeoutFailure'
error: 'test timed out after 1ms'
code: 'ERR_TEST_FAILURE'
...
# Subtest: promise test that times out
not ok 2 - promise test that times out
---
duration_ms: *
location: '/test/fixtures/test-runner/output/timeout_ref.js:(LINE):1'
failureType: 'testTimeoutFailure'
error: 'test timed out after 1ms'
code: 'ERR_TEST_FAILURE'
...
1..2
# tests 2
# suites 0
# pass 0
# fail 0
# cancelled 2
# skipped 0
# todo 0
# duration_ms *
1 change: 1 addition & 0 deletions test/parallel/test-runner-output.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const tests = [
{ name: 'test-runner/output/hooks.js' },
{ name: 'test-runner/output/hooks_spec_reporter.js', transform: specTransform },
{ name: 'test-runner/output/timeout_in_before_each_should_not_affect_further_tests.js' },
{ name: 'test-runner/output/timeout_ref.js' },
{ name: 'test-runner/output/hooks-with-no-global-test.js' },
{ name: 'test-runner/output/global-hooks-with-no-tests.js' },
{ name: 'test-runner/output/before-and-after-each-too-many-listeners.js' },
Expand Down