@@ -28,6 +28,8 @@ class CancelRun extends Error {
28
28
}
29
29
}
30
30
31
+ type TestRunner = ( runTestOptions : RunTestOptions ) => TestResult ;
32
+
31
33
export default function createRunner <
32
34
ExtraOptions extends Record < string , unknown > ,
33
35
> (
@@ -76,7 +78,7 @@ export default function createRunner<
76
78
onFailure : OnTestFailure ,
77
79
options : TestRunnerOptions ,
78
80
) : Promise < void > {
79
- const runner = ( await import ( runPath ) ) . default ;
81
+ const runner : TestRunner = ( await import ( runPath ) ) . default ;
80
82
81
83
const mutex = pLimit ( 1 ) ;
82
84
return tests . reduce (
@@ -100,10 +102,6 @@ export default function createRunner<
100
102
extraOptions : getExtraOptions ? getExtraOptions ( ) : { } ,
101
103
} ;
102
104
103
- if ( typeof runner . default === 'function' ) {
104
- return runner . default ( baseOptions ) ;
105
- }
106
-
107
105
return runner ( baseOptions ) ;
108
106
} ) ;
109
107
} )
@@ -127,9 +125,7 @@ export default function createRunner<
127
125
exposedMethods : [ 'default' ] ,
128
126
numWorkers : this . #globalConfig. maxWorkers ,
129
127
forkOptions : { stdio : 'inherit' } ,
130
- } ) as JestWorkerFarm < {
131
- default : ( runTestOptions : RunTestOptions ) => TestResult ;
132
- } > ;
128
+ } ) as JestWorkerFarm < { default : TestRunner } > ;
133
129
134
130
const mutex = pLimit ( this . #globalConfig. maxWorkers ) ;
135
131
0 commit comments