Skip to content

Commit 690c41b

Browse files
authored
chore(run): remove workaround for exit-hook issue (#24)
Remove the workaround for the exit-hook issue where `gracefulExit( 1 )` was not exiting with the right signal. The issue has been resolved in exit-hook v5.0.1. See sindresorhus/exit-hook#42
1 parent 2337329 commit 690c41b

File tree

3 files changed

+25
-40
lines changed

3 files changed

+25
-40
lines changed

package-lock.json

Lines changed: 20 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"chalk": "^5.6.2",
4040
"commander": "^14.0.2",
4141
"diff": "^8.0.2",
42-
"exit-hook": "^5.0.0",
42+
"exit-hook": "^5.0.1",
4343
"jsdom": "^27.2.0",
4444
"raw-body": "^3.0.1",
4545
"selenium-webdriver": "^4.38.0",

run.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,6 @@ export async function run( {
206206
{ wait: EXIT_HOOK_WAIT_TIMEOUT }
207207
);
208208

209-
// There is currently a bug in exit-hook where
210-
// gracefulExit(1) is not longer respected.
211-
// Work around by setting process.exitCode instead.
212-
// See https://github.com/sindresorhus/exit-hook/issues/42
213-
function exitWithError() {
214-
process.exitCode = 1;
215-
gracefulExit();
216-
}
217-
218209
// Start up BrowserStackLocal
219210
let tunnel;
220211
if ( browserstack ) {
@@ -251,7 +242,7 @@ export async function run( {
251242
console.error(
252243
chalk.red( `Browser not found: ${ getBrowserString( browser ) }.` )
253244
);
254-
exitWithError();
245+
gracefulExit( 1 );
255246
}
256247
return latestMatch;
257248
} )
@@ -344,7 +335,7 @@ export async function run( {
344335
} catch ( error ) {
345336
console.error( error );
346337
if ( !debug ) {
347-
exitWithError();
338+
gracefulExit( 1 );
348339
}
349340
} finally {
350341
console.log();
@@ -363,7 +354,7 @@ export async function run( {
363354
}
364355
}
365356
if ( stop ) {
366-
exitWithError();
357+
gracefulExit( 1 );
367358
return;
368359
}
369360
console.log( chalk.green( "All tests passed!" ) );
@@ -391,7 +382,7 @@ export async function run( {
391382
}
392383
console.log( "Press Ctrl+C to exit." );
393384
} else {
394-
exitWithError();
385+
gracefulExit( 1 );
395386
}
396387
}
397388
}

0 commit comments

Comments
 (0)