Skip to content

Commit

Permalink
fix repl by es6 export Runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
thymikee committed Dec 15, 2018
1 parent 6a663d0 commit 63e06be
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/jest-cli/src/__tests__/SearchSource.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: '.',
Expand Down
7 changes: 4 additions & 3 deletions packages/jest-runner/src/runTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<RuntimeClass>);
const Runtime = ((config.moduleLoader
? /* $FlowFixMe */
require(config.moduleLoader)
: require('jest-runtime').default): Class<RuntimeClass>);

let runtime = undefined;

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-runtime/src/__mocks__/createRuntime.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
3 changes: 2 additions & 1 deletion packages/jest-runtime/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -966,4 +966,5 @@ class Runtime {
}

Runtime.ScriptTransformer = ScriptTransformer;
module.exports = Runtime;

export default Runtime;

0 comments on commit 63e06be

Please sign in to comment.