Skip to content

Commit

Permalink
Migrate back to CommonJS export for jest-runtime (#7608)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubennorte committed Jan 11, 2019
1 parent 6a066c6 commit 4f2bcb8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 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').default;
Runtime = require('jest-runtime');
SearchSource = require('../SearchSource').default;
normalize = require('jest-config').normalize;
});
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').default;
Runtime = require('jest-runtime');
config = normalize(
{
rootDir: '.',
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-runner/src/runTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async function runTestInternal(
const Runtime = ((config.moduleLoader
? /* $FlowFixMe */
require(config.moduleLoader)
: require('jest-runtime').default): Class<RuntimeClass>);
: require('jest-runtime')): 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('../').default;
const Runtime = require('../');

const {normalize} = require('jest-config');

Expand Down
6 changes: 4 additions & 2 deletions packages/jest-runtime/src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import yargs from 'yargs';
import {Console, setGlobal} from 'jest-util';
import {validateCLIOptions} from 'jest-validate';
import {readConfig, deprecationEntries} from 'jest-config';
// eslint-disable-next-line import/default
import Runtime from '../';
import * as args from './args';

const VERSION = (require('../../package.json').version: string);
Expand Down Expand Up @@ -75,6 +73,10 @@ export function run(cliArgv?: Argv, cliInfo?: Array<string>) {
automock: false,
unmockedModulePathPatterns: null,
});

// Break circular dependency
const Runtime = require('..');

Runtime.createContext(config, {
maxWorkers: Math.max(os.cpus().length - 1, 1),
watchman: globalConfig.watchman,
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-runtime/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1017,4 +1017,4 @@ class Runtime {

Runtime.ScriptTransformer = ScriptTransformer;

export default Runtime;
module.exports = Runtime;

0 comments on commit 4f2bcb8

Please sign in to comment.