Skip to content

Commit 7bf3ba6

Browse files
committed
fix issue found in tests
1 parent db19e9a commit 7bf3ba6

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

‎lib/internal/test_runner/harness.js‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,16 @@ function setup(root){
126126
}
127127
};
128128

129+
constterminationHandler=()=>{
130+
exitHandler();
131+
process.exit();
132+
}
133+
129134
process.on('uncaughtException',exceptionHandler);
130135
process.on('unhandledRejection',rejectionHandler);
131136
process.on('beforeExit',exitHandler);
132-
process.on('SIGINT',exitHandler);
133-
process.on('SIGTERM',exitHandler);
137+
process.on('SIGINT',terminationHandler);
138+
process.on('SIGTERM',terminationHandler);
134139

135140
root.reporter.pipe(process.stdout);
136141
root.reporter.version();

‎test/parallel/test-runner-exit-code.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
require('../common');
33
constassert=require('assert');
44
const{ spawnSync }=require('child_process');
5+
const{ setTimeout }=require('timers/promises');
56

67
if(process.argv[2]==='child'){
78
consttest=require('node:test');
@@ -18,7 +19,7 @@ if (process.argv[2] === 'child'){
1819
}elseif(process.argv[3]==='never_ends'){
1920
assert.strictEqual(process.argv[3],'never_ends');
2021
test('never ending test',()=>{
21-
returnnewPromise(()=>{});
22+
returnsetTimeout(100_000_000);
2223
});
2324
process.kill(process.pid,'SIGINT');
2425
}

0 commit comments

Comments
(0)