From 63e06be5a41e22e2d67e01145eae76ea7c7f5e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Sat, 15 Dec 2018 12:01:07 +0100 Subject: [PATCH] fix repl by es6 export Runtime --- packages/jest-cli/src/__tests__/SearchSource.test.js | 2 +- .../jest-cli/src/__tests__/generateEmptyCoverage.test.js | 2 +- .../src/__tests__/dependency_resolver.test.js | 2 +- packages/jest-runner/src/runTest.js | 7 ++++--- packages/jest-runtime/src/__mocks__/createRuntime.js | 2 +- packages/jest-runtime/src/index.js | 3 ++- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/jest-cli/src/__tests__/SearchSource.test.js b/packages/jest-cli/src/__tests__/SearchSource.test.js index 1e3ea1d2561b..b2931b197327 100644 --- a/packages/jest-cli/src/__tests__/SearchSource.test.js +++ b/packages/jest-cli/src/__tests__/SearchSource.test.js @@ -31,7 +31,7 @@ describe('SearchSource', () => { let searchSource; beforeEach(() => { - Runtime = require('jest-runtime'); + Runtime = require('jest-runtime').default; SearchSource = require('../SearchSource').default; normalize = require('jest-config').normalize; }); diff --git a/packages/jest-cli/src/__tests__/generateEmptyCoverage.test.js b/packages/jest-cli/src/__tests__/generateEmptyCoverage.test.js index 8245f914e312..58f464cd3801 100644 --- a/packages/jest-cli/src/__tests__/generateEmptyCoverage.test.js +++ b/packages/jest-cli/src/__tests__/generateEmptyCoverage.test.js @@ -14,7 +14,7 @@ const os = require('os'); const {makeGlobalConfig, makeProjectConfig} = require('../../../../TestUtils'); jest.mock('jest-runtime', () => { - const realRuntime = jest.requireActual('jest-runtime'); + const realRuntime = jest.requireActual('jest-runtime').default; realRuntime.shouldInstrument = () => true; return realRuntime; }); diff --git a/packages/jest-resolve-dependencies/src/__tests__/dependency_resolver.test.js b/packages/jest-resolve-dependencies/src/__tests__/dependency_resolver.test.js index 9bc911c89e70..1b35c58c3693 100644 --- a/packages/jest-resolve-dependencies/src/__tests__/dependency_resolver.test.js +++ b/packages/jest-resolve-dependencies/src/__tests__/dependency_resolver.test.js @@ -23,7 +23,7 @@ const cases = { const filter = path => Object.keys(cases).every(key => cases[key](path)); beforeEach(() => { - Runtime = require('jest-runtime'); + Runtime = require('jest-runtime').default; config = normalize( { rootDir: '.', diff --git a/packages/jest-runner/src/runTest.js b/packages/jest-runner/src/runTest.js index 8908a54b58ec..90ffbb503fd7 100644 --- a/packages/jest-runner/src/runTest.js +++ b/packages/jest-runner/src/runTest.js @@ -70,9 +70,10 @@ async function runTestInternal( ? require('jest-circus/runner') // eslint-disable-line import/no-extraneous-dependencies : /* $FlowFixMe */ require(config.testRunner)): TestFramework); - /* $FlowFixMe */ - const Runtime = (require(config.moduleLoader || - 'jest-runtime'): Class); + const Runtime = ((config.moduleLoader + ? /* $FlowFixMe */ + require(config.moduleLoader) + : require('jest-runtime').default): Class); let runtime = undefined; diff --git a/packages/jest-runtime/src/__mocks__/createRuntime.js b/packages/jest-runtime/src/__mocks__/createRuntime.js index 7300afa587a8..b16d33d9a85b 100644 --- a/packages/jest-runtime/src/__mocks__/createRuntime.js +++ b/packages/jest-runtime/src/__mocks__/createRuntime.js @@ -9,7 +9,7 @@ import path from 'path'; module.exports = function createRuntime(filename, config) { const NodeEnvironment = require('jest-environment-node'); - const Runtime = require('../'); + const Runtime = require('../').default; const {normalize} = require('jest-config'); diff --git a/packages/jest-runtime/src/index.js b/packages/jest-runtime/src/index.js index f91e481a2925..84601fccd9c5 100644 --- a/packages/jest-runtime/src/index.js +++ b/packages/jest-runtime/src/index.js @@ -966,4 +966,5 @@ class Runtime { } Runtime.ScriptTransformer = ScriptTransformer; -module.exports = Runtime; + +export default Runtime;