Skip to content

Commit c7a6cc2

Browse files
committed
extract type
1 parent b3a12de commit c7a6cc2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/createJestRunner.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class CancelRun extends Error {
3030
}
3131
}
3232

33+
type TestRunner = (runTestOptions: RunTestOptions) => TestResult;
34+
3335
export default function createRunner<
3436
ExtraOptions extends Record<string, unknown>,
3537
>(
@@ -87,9 +89,7 @@ export default function createRunner<
8789
onFailure: OnTestFailure,
8890
options: TestRunnerOptions,
8991
): Promise<void> {
90-
const runner: (runTestOptions: RunTestOptions) => TestResult = (
91-
await import(runPath)
92-
).default;
92+
const runner: TestRunner = (await import(runPath)).default;
9393

9494
const mutex = pLimit(1);
9595
return tests.reduce(
@@ -136,9 +136,7 @@ export default function createRunner<
136136
exposedMethods: ['default'],
137137
numWorkers: this.#globalConfig.maxWorkers,
138138
forkOptions: { stdio: 'inherit' },
139-
}) as JestWorkerFarm<{
140-
default: (runTestOptions: RunTestOptions) => TestResult;
141-
}>;
139+
}) as JestWorkerFarm<{ default: TestRunner }>;
142140

143141
const mutex = pLimit(this.#globalConfig.maxWorkers);
144142

0 commit comments

Comments
 (0)