Skip to content

Commit

Permalink
now, please
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Dec 25, 2018
1 parent 39514d9 commit e8ba1ba
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/jest-repl/bin/jest-repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ if (process.env.NODE_ENV == null) {
process.env.NODE_ENV = 'test';
}

require('../build/cli')();
require('../build/cli').default();
1 change: 1 addition & 0 deletions packages/jest-repl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"dependencies": {
"jest-config": "^23.6.0",
"jest-runtime": "^23.6.0",
"jest-util": "^23.4.0",
"jest-validate": "^23.6.0",
"repl": "^0.1.3",
"yargs": "^12.0.2"
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-repl/src/__tests__/jest_repl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
'use strict';

import {spawnSync} from 'child_process';
import path from 'path';
import {skipSuiteOnWindows} from '../../../../scripts/ConditionalTest';

const JEST_RUNTIME = path.resolve(__dirname, '../../bin/jest-repl.js');
const JEST_RUNTIME = require.resolve('../../bin/jest-repl.js');

describe('Repl', () => {
skipSuiteOnWindows();
Expand All @@ -23,6 +22,7 @@ describe('Repl', () => {
encoding: 'utf8',
env: process.env,
});
expect(output.stderr.trim()).toBe('');
expect(output.stdout.trim()).toMatch(//);
});
});
Expand Down
5 changes: 3 additions & 2 deletions packages/jest-repl/src/cli/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ declare var jest: Object;
import path from 'path';
import repl from 'repl';
import vm from 'vm';
import {interopRequireDefault} from 'jest-util';

let transformer;

Expand Down Expand Up @@ -59,8 +60,8 @@ if (jestProjectConfig.transform) {
}
}
if (transformerPath) {
/* $FlowFixMe */
transformer = require(transformerPath);
// $FlowFixMe
transformer = interopRequireDefault(require(transformerPath)).default;
if (typeof transformer.process !== 'function') {
throw new TypeError(
'Jest: a transformer must export a `process` function.',
Expand Down
8 changes: 5 additions & 3 deletions packages/jest-runtime/src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import chalk from 'chalk';
import os from 'os';
import path from 'path';
import yargs from 'yargs';
import {Console, setGlobal} from 'jest-util';
import {Console, interopRequireDefault, setGlobal} from 'jest-util';
import {validateCLIOptions} from 'jest-validate';
import {readConfig, deprecationEntries} from 'jest-config';
import Runtime from '../';
Expand Down Expand Up @@ -79,8 +79,10 @@ export function run(cliArgv?: Argv, cliInfo?: Array<string>) {
watchman: globalConfig.watchman,
})
.then(hasteMap => {
/* $FlowFixMe */
const Environment = (require(config.testEnvironment): EnvironmentClass);
const Environment = (interopRequireDefault(
// $FlowFixMe
require(config.testEnvironment),
).default: EnvironmentClass);
const environment = new Environment(config);
setGlobal(
environment.global,
Expand Down

0 comments on commit e8ba1ba

Please sign in to comment.