File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -481,6 +481,7 @@ describe('restart(testFilePath)', () => {
481481 const platformInstance = createPlatformRunner ( {
482482 restartApp,
483483 stopApp,
484+ isAppRunning : vi . fn ( async ( ) => false ) ,
484485 createAppMonitor : ( ) => appMonitor . appMonitor ,
485486 } ) ;
486487
@@ -528,17 +529,17 @@ describe('restart(testFilePath)', () => {
528529 await flush ( ) ;
529530
530531 expect ( stopApp ) . toHaveBeenCalledTimes ( 1 ) ;
531- expect ( restartApp ) . toHaveBeenCalledTimes ( 1 ) ;
532- expect ( restartApp ) . toHaveBeenNthCalledWith ( 1 , {
533- extras : {
534- source : 'restart' ,
535- } ,
536- } ) ;
532+ expect ( restartApp ) . toHaveBeenCalledTimes ( 0 ) ;
537533
538534 await vi . advanceTimersByTimeAsync ( 1_000 ) ;
539535 await flush ( ) ;
540536
541537 expect ( restartApp ) . toHaveBeenCalledTimes ( 2 ) ;
538+ expect ( restartApp ) . toHaveBeenNthCalledWith ( 1 , {
539+ extras : {
540+ source : 'restart' ,
541+ } ,
542+ } ) ;
542543 expect ( restartApp ) . toHaveBeenNthCalledWith ( 2 , {
543544 extras : {
544545 source : 'restart' ,
Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ describe('JestHarness', () => {
1414 ensureAppReady : vi
1515 . fn ( )
1616 . mockRejectedValue ( new StartupStallError ( 1500 , 3 ) ) ,
17+ callHook : vi . fn ( async ( ) => undefined ) ,
18+ setRunState : vi . fn ( ) ,
19+ getRunState : vi . fn ( ( ) => null ) ,
1720 crashSupervisor : {
1821 beginTestRun : vi . fn ( ) ,
1922 waitForCrash : vi . fn ( ) ,
Original file line number Diff line number Diff line change @@ -236,7 +236,7 @@ const getHarnessInternal = async (
236236 maybeLogMetroCacheReuse ( config , platform , projectRoot ) ;
237237 const pluginAbortController = new AbortController ( ) ;
238238 const pluginManager = createHarnessPluginManager < HarnessConfig , HarnessPlatform > ( {
239- plugins : config . plugins as Array <
239+ plugins : ( config . plugins ?? [ ] ) as Array <
240240 HarnessPlugin < object , HarnessConfig , HarnessPlatform >
241241 > ,
242242 projectRoot,
Original file line number Diff line number Diff line change @@ -114,8 +114,9 @@ export default class JestHarness implements CallbackTestRunnerInterface {
114114 const startTime = Date . now ( ) ;
115115 const runId = randomUUID ( ) ;
116116 const watchMode = this . #globalConfig. watch || this . #globalConfig. watchAll ;
117+ const rootDir = this . #globalConfig. rootDir ?? process . cwd ( ) ;
117118 const testFiles = tests . map ( ( test ) =>
118- path . relative ( this . #globalConfig . rootDir , test . path )
119+ path . relative ( rootDir , test . path )
119120 ) ;
120121 const summary = createRunSummary ( ) ;
121122 const updateRunState = ( overrides : Partial < HarnessRunState > = { } ) => {
@@ -157,7 +158,7 @@ export default class JestHarness implements CallbackTestRunnerInterface {
157158 return promise
158159 . then ( async ( ) => {
159160 const relativeTestPath = path . relative (
160- this . #globalConfig . rootDir ,
161+ rootDir ,
161162 test . path
162163 ) ;
163164 const testFileStartedAt = Date . now ( ) ;
You can’t perform that action at this time.
0 commit comments