Skip to content

Commit 5c50f77

Browse files
committed
fixup! add exitWithError to handle exit codes properly
1 parent 2276c3d commit 5c50f77

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

.github/workflows/jquery.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ jobs:
4141
working-directory: test/jquery
4242
run: npm run test:browser -- -v
4343

44-
- name: Run jQuery tests in Edge in IE mode
45-
working-directory: test/jquery
46-
run: npm run test:ie -- -v
47-
4844
ie:
4945
runs-on: windows-latest
5046
name: Test jQuery with IEDriver

run.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,15 @@ 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 araound 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+
209218
// Start up BrowserStackLocal
210219
let tunnel;
211220
if ( browserstack ) {
@@ -242,7 +251,7 @@ export async function run( {
242251
console.error(
243252
chalk.red( `Browser not found: ${ getBrowserString( browser ) }.` )
244253
);
245-
gracefulExit( 1 );
254+
exitWithError();
246255
}
247256
return latestMatch;
248257
} )
@@ -335,7 +344,7 @@ export async function run( {
335344
} catch ( error ) {
336345
console.error( error );
337346
if ( !debug ) {
338-
gracefulExit( 1 );
347+
exitWithError();
339348
}
340349
} finally {
341350
console.log();
@@ -354,12 +363,13 @@ export async function run( {
354363
}
355364
}
356365
if ( stop ) {
357-
return gracefulExit( 1 );
366+
exitWithError();
367+
return;
358368
}
359369
console.log( chalk.green( "All tests passed!" ) );
360370

361371
if ( !debug || browserstack ) {
362-
gracefulExit( 0 );
372+
gracefulExit();
363373
}
364374
} else {
365375
console.error(
@@ -381,7 +391,7 @@ export async function run( {
381391
}
382392
console.log( "Press Ctrl+C to exit." );
383393
} else {
384-
gracefulExit( 1 );
394+
exitWithError();
385395
}
386396
}
387397
}

0 commit comments

Comments
 (0)