@@ -28,6 +28,8 @@ class CancelRun extends Error {
2828 }
2929}
3030
31+ type TestRunner = ( runTestOptions : RunTestOptions ) => TestResult ;
32+
3133export default function createRunner <
3234 ExtraOptions extends Record < string , unknown > ,
3335> (
@@ -76,7 +78,7 @@ export default function createRunner<
7678 onFailure : OnTestFailure ,
7779 options : TestRunnerOptions ,
7880 ) : Promise < void > {
79- const runner = ( await import ( runPath ) ) . default ;
81+ const runner : TestRunner = ( await import ( runPath ) ) . default ;
8082
8183 const mutex = pLimit ( 1 ) ;
8284 return tests . reduce (
@@ -100,10 +102,6 @@ export default function createRunner<
100102 extraOptions : getExtraOptions ? getExtraOptions ( ) : { } ,
101103 } ;
102104
103- if ( typeof runner . default === 'function' ) {
104- return runner . default ( baseOptions ) ;
105- }
106-
107105 return runner ( baseOptions ) ;
108106 } ) ;
109107 } )
@@ -127,9 +125,7 @@ export default function createRunner<
127125 exposedMethods : [ 'default' ] ,
128126 numWorkers : this . #globalConfig. maxWorkers ,
129127 forkOptions : { stdio : 'inherit' } ,
130- } ) as JestWorkerFarm < {
131- default : ( runTestOptions : RunTestOptions ) => TestResult ;
132- } > ;
128+ } ) as JestWorkerFarm < { default : TestRunner } > ;
133129
134130 const mutex = pLimit ( this . #globalConfig. maxWorkers ) ;
135131
0 commit comments