From 1466f9a988d11a4c43cd7c97f195b0eacb75c96f Mon Sep 17 00:00:00 2001 From: Nico Jansen Date: Thu, 19 Nov 2020 20:08:45 +0100 Subject: [PATCH] feat(jest-runner): resolve local jest version (#2623) --- packages/jest-runner/src/utils/jest-wrapper.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/jest-runner/src/utils/jest-wrapper.ts b/packages/jest-runner/src/utils/jest-wrapper.ts index cfff2cbfe2..eb1b2a3cf1 100644 --- a/packages/jest-runner/src/utils/jest-wrapper.ts +++ b/packages/jest-runner/src/utils/jest-wrapper.ts @@ -1,10 +1,14 @@ -import * as jest from 'jest'; +import { requireResolve } from '@stryker-mutator/util'; +import type * as jestModule from 'jest'; + +// Use requireResolve, that way you can use this plugin from a different directory +const jest = requireResolve('jest') as typeof jestModule; /** * Direct stubbing on jest is no longer possible since jest > 25 */ class JestWrapper { - public runCLI: typeof jest.runCLI = (...args) => { + public runCLI: typeof jestModule.runCLI = (...args) => { return jest.runCLI(...args); }; }