Skip to content

Commit f1108ea

Browse files
authored
fix: use import instead of require when loading runner (#148)
1 parent ee87056 commit f1108ea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/createJestRunner.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,16 @@ export default function createRunner<
6868
);
6969
}
7070

71-
_createInBandTestRun(
71+
async _createInBandTestRun(
7272
tests: Array<Test>,
7373
watcher: TestWatcher,
7474
onStart: OnTestStart,
7575
onResult: OnTestSuccess,
7676
onFailure: OnTestFailure,
7777
options: TestRunnerOptions,
7878
): Promise<void> {
79+
const runner = (await import(runPath)).default;
80+
7981
const mutex = pLimit(1);
8082
return tests.reduce(
8183
(promise, test) =>
@@ -87,8 +89,6 @@ export default function createRunner<
8789
}
8890

8991
return onStart(test).then(() => {
90-
// eslint-disable-next-line import/no-dynamic-require, global-require, @typescript-eslint/no-var-requires
91-
const runner = require(runPath);
9292
const baseOptions = {
9393
config: test.context.config,
9494
globalConfig: this.#globalConfig,

0 commit comments

Comments
 (0)