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;