@@ -29,10 +29,9 @@ const mocks = vi.hoisted(() => ({
2929} ) ) ;
3030
3131vi . mock ( '@react-native-harness/bundler-metro' , async ( ) => {
32- const actual =
33- await vi . importActual < typeof import ( '@react-native-harness/bundler-metro' ) > (
34- '@react-native-harness/bundler-metro'
35- ) ;
32+ const actual = await vi . importActual <
33+ typeof import ( '@react-native-harness/bundler-metro' )
34+ > ( '@react-native-harness/bundler-metro' ) ;
3635
3736 return {
3837 ...actual ,
@@ -51,10 +50,9 @@ vi.mock('../logs.js', () => ({
5150} ) ) ;
5251
5352vi . mock ( '@react-native-harness/tools' , async ( ) => {
54- const actual =
55- await vi . importActual < typeof import ( '@react-native-harness/tools' ) > (
56- '@react-native-harness/tools'
57- ) ;
53+ const actual = await vi . importActual <
54+ typeof import ( '@react-native-harness/tools' )
55+ > ( '@react-native-harness/tools' ) ;
5856
5957 return {
6058 ...actual ,
@@ -186,7 +184,7 @@ const createHarnessConfig = (
186184 unstable__skipAlreadyIncludedModules : false ,
187185 webSocketPort : 3001 ,
188186 ...overrides ,
189- } ) as HarnessConfig ;
187+ } as HarnessConfig ) ;
190188
191189beforeEach ( ( ) => {
192190 vi . clearAllMocks ( ) ;
@@ -310,9 +308,7 @@ describe('getHarness', () => {
310308 mocks . waitForMetroBackedAppReady . mockImplementationOnce (
311309 async ( options : WaitForMetroBackedAppReadyOptions ) => {
312310 await options . startAttempt ( ) ;
313- const readyPromise = options . waitForReady (
314- new AbortController ( ) . signal
315- ) ;
311+ const readyPromise = options . waitForReady ( new AbortController ( ) . signal ) ;
316312 emitReady ( ) ;
317313 await readyPromise ;
318314 }
@@ -375,9 +371,7 @@ describe('getHarness', () => {
375371 mocks . waitForMetroBackedAppReady . mockImplementationOnce (
376372 async ( options : WaitForMetroBackedAppReadyOptions ) => {
377373 await options . startAttempt ( ) ;
378- const readyPromise = options . waitForReady (
379- new AbortController ( ) . signal
380- ) ;
374+ const readyPromise = options . waitForReady ( new AbortController ( ) . signal ) ;
381375 emitReady ( ) ;
382376 await readyPromise ;
383377 }
@@ -473,7 +467,25 @@ describe('plugins', () => {
473467 beforeCreation : ( ctx ) => {
474468 ctx . state . creationCount += 1 ;
475469 observedHooks . push (
476- `beforeCreation:${ ctx . platform . platformId } :${ ctx . appLaunchOptions == null ? 'no-launch-options' : 'launch-options' } `
470+ `beforeCreation:${ ctx . platform . platformId } :${
471+ ctx . appLaunchOptions == null
472+ ? 'no-launch-options'
473+ : 'launch-options'
474+ } `
475+ ) ;
476+ } ,
477+ beforeRun : ( ctx ) => {
478+ observedHooks . push (
479+ `beforeRun:${ ctx . platform . platformId } :${
480+ ctx . appLaunchOptions == null
481+ ? 'no-launch-options'
482+ : 'launch-options'
483+ } `
484+ ) ;
485+ } ,
486+ afterRun : ( ctx ) => {
487+ observedHooks . push (
488+ `afterRun:${ ctx . state . creationCount } :${ ctx . reason } `
477489 ) ;
478490 } ,
479491 beforeDispose : ( ctx ) => {
@@ -484,7 +496,9 @@ describe('plugins', () => {
484496 } ,
485497 runtime : {
486498 ready : ( ctx ) => {
487- observedHooks . push ( `runtime.ready:${ ctx . runId } :${ ctx . device . platform } ` ) ;
499+ observedHooks . push (
500+ `runtime.ready:${ ctx . runId } :${ ctx . device . platform } `
501+ ) ;
488502 } ,
489503 disconnected : ( ctx ) => {
490504 observedHooks . push ( `runtime.disconnected:${ ctx . reason } ` ) ;
@@ -547,9 +561,11 @@ describe('plugins', () => {
547561
548562 expect ( observedHooks ) . toEqual ( [
549563 'beforeCreation:ios:launch-options' ,
564+ 'beforeRun:ios:launch-options' ,
550565 'runtime.ready:run-1:ios' ,
551566 'collection.started:example.harness.ts' ,
552567 'runtime.disconnected:bridge-disconnected' ,
568+ 'afterRun:1:normal' ,
553569 'beforeDispose:1:normal' ,
554570 ] ) ;
555571 } ) ;
0 commit comments