Skip to content

Commit

Permalink
extract type
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Sep 14, 2022
1 parent b3a12de commit c7a6cc2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/createJestRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class CancelRun extends Error {
}
}

type TestRunner = (runTestOptions: RunTestOptions) => TestResult;

export default function createRunner<
ExtraOptions extends Record<string, unknown>,
>(
Expand Down Expand Up @@ -87,9 +89,7 @@ export default function createRunner<
onFailure: OnTestFailure,
options: TestRunnerOptions,
): Promise<void> {
const runner: (runTestOptions: RunTestOptions) => TestResult = (
await import(runPath)
).default;
const runner: TestRunner = (await import(runPath)).default;

const mutex = pLimit(1);
return tests.reduce(
Expand Down Expand Up @@ -136,9 +136,7 @@ export default function createRunner<
exposedMethods: ['default'],
numWorkers: this.#globalConfig.maxWorkers,
forkOptions: { stdio: 'inherit' },
}) as JestWorkerFarm<{
default: (runTestOptions: RunTestOptions) => TestResult;
}>;
}) as JestWorkerFarm<{ default: TestRunner }>;

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

Expand Down

0 comments on commit c7a6cc2

Please sign in to comment.