@@ -156,8 +156,11 @@ function filterExecArgv(arg, i, arr) {
156156  ! ArrayPrototypeSome ( kFilterArgValues ,  ( p )  =>  arg  ===  p  ||  ( i  >  0  &&  arr [ i  -  1 ]  ===  p )  ||  StringPrototypeStartsWith ( arg ,  `${ p }  ) ) ; 
157157} 
158158
159- function  getRunArgs ( path ,  {  inspectPort,  testNamePatterns,  only } )  { 
159+ function  getRunArgs ( path ,  {  forceExit ,   inspectPort,  testNamePatterns,  only } )  { 
160160  const  argv  =  ArrayPrototypeFilter ( process . execArgv ,  filterExecArgv ) ; 
161+   if  ( forceExit  ===  true )  { 
162+     ArrayPrototypePush ( argv ,  '--test-force-exit' ) ; 
163+   } 
161164  if  ( isUsingInspector ( ) )  { 
162165    ArrayPrototypePush ( argv ,  `--inspect-port=${ getInspectPort ( inspectPort ) }  ) ; 
163166  } 
@@ -490,14 +493,33 @@ function run(options) {
490493    options  =  kEmptyObject ; 
491494  } 
492495  let  {  testNamePatterns,  shard }  =  options ; 
493-   const  {  concurrency,  timeout,  signal,  files,  inspectPort,  watch,  setup,  only }  =  options ; 
496+   const  { 
497+     concurrency, 
498+     timeout, 
499+     signal, 
500+     files, 
501+     forceExit, 
502+     inspectPort, 
503+     watch, 
504+     setup, 
505+     only, 
506+   }  =  options ; 
494507
495508  if  ( files  !=  null )  { 
496509    validateArray ( files ,  'options.files' ) ; 
497510  } 
498511  if  ( watch  !=  null )  { 
499512    validateBoolean ( watch ,  'options.watch' ) ; 
500513  } 
514+   if  ( forceExit  !=  null )  { 
515+     validateBoolean ( forceExit ,  'options.forceExit' ) ; 
516+ 
517+     if  ( forceExit  &&  watch )  { 
518+       throw  new  ERR_INVALID_ARG_VALUE ( 
519+         'options.forceExit' ,  watch ,  'is not supported with watch mode' , 
520+       ) ; 
521+     } 
522+   } 
501523  if  ( only  !=  null )  { 
502524    validateBoolean ( only ,  'options.only' ) ; 
503525  } 
@@ -553,7 +575,15 @@ function run(options) {
553575
554576  let  postRun  =  ( )  =>  root . postRun ( ) ; 
555577  let  filesWatcher ; 
556-   const  opts  =  {  __proto__ : null ,  root,  signal,  inspectPort,  testNamePatterns,  only } ; 
578+   const  opts  =  { 
579+     __proto__ : null , 
580+     root, 
581+     signal, 
582+     inspectPort, 
583+     testNamePatterns, 
584+     only, 
585+     forceExit, 
586+   } ; 
557587  if  ( watch )  { 
558588    filesWatcher  =  watchFiles ( testFiles ,  opts ) ; 
559589    postRun  =  undefined ; 
0 commit comments