@@ -36,7 +36,7 @@ function print(...msgs) {
3636 console . log . apply ( console , msgs ) ;
3737}
3838
39- function exec ( executable , args , cwd , inheritStdio = true ) {
39+ function exec ( executable , args , cwd , inheritStdio = true , noExit = false ) {
4040 print (
4141 `${ executable
4242 . replaceAll ( YARN_PATH , "yarn" )
@@ -56,15 +56,17 @@ function exec(executable, args, cwd, inheritStdio = true) {
5656 `\ncommand: ${ executable } ${ args . join ( " " ) } \ncode: ${ error . exitCode } `
5757 )
5858 ) ;
59- // eslint-disable-next-line no-process-exit
60- process . exit ( error . exitCode ) ;
59+ if ( ! noExit ) {
60+ // eslint-disable-next-line no-process-exit
61+ process . exit ( error . exitCode ) ;
62+ }
6163 }
6264 throw error ;
6365 }
6466}
6567
66- function yarn ( args , cwd , inheritStdio ) {
67- return exec ( YARN_PATH , args , cwd , inheritStdio ) ;
68+ function yarn ( args , cwd , inheritStdio , noExit ) {
69+ return exec ( YARN_PATH , args , cwd , inheritStdio , noExit ) ;
6870}
6971
7072function node ( args , cwd , inheritStdio ) {
@@ -382,11 +384,25 @@ function eslint(...extraArgs) {
382384 NODE_OPTIONS : "--max-old-space-size=16384" ,
383385 } ) ;
384386 } else {
387+ let err = null ;
385388 for ( const chunk of chunks ) {
386- env ( ( ) => yarn ( [ "eslint" , ...chunk , ...eslintArgs ] ) , {
387- BABEL_ENV : "test" ,
388- } ) ;
389+ try {
390+ env (
391+ ( ) =>
392+ yarn (
393+ [ "eslint" , ...chunk , ...eslintArgs ] ,
394+ undefined ,
395+ undefined ,
396+ true
397+ ) ,
398+ { BABEL_ENV : "test" }
399+ ) ;
400+ } catch ( e ) {
401+ err = e ;
402+ }
389403 }
404+ // eslint-disable-next-line no-process-exit
405+ if ( err ) process . exit ( err . exitCode ) ;
390406 }
391407}
392408
0 commit comments