Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use babel transform to inline all requires #3786

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"transform-es2015-parameters",
"transform-async-to-generator",
"transform-strict-mode",
["transform-es2015-modules-commonjs", {"allowTopLevelThis": true}]
["transform-inline-imports-commonjs", {"allowTopLevelThis": true, "excludeModules": ["jest-matcher-utils"]}]
],
"retainLines": true
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be removed

"babel-plugin-transform-es2015-parameters": "^6.23.0",
"babel-plugin-transform-flow-strip-types": "^6.18.0",
"babel-plugin-transform-inline-imports-commonjs": "^1.2.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-plugin-transform-strict-mode": "^6.24.1",
"babel-preset-env": "^1.4.0",
Expand Down
10 changes: 5 additions & 5 deletions packages/jest-runtime/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ import type {Context} from 'types/Context';
import type {ModuleMap} from 'jest-haste-map';
import type {MockFunctionMetadata, ModuleMocker} from 'types/Mock';

import path from 'path';
import HasteMap from 'jest-haste-map';
import Resolver from 'jest-resolve';
import {createDirectory} from 'jest-util';
import {escapePathForRegex} from 'jest-regex-util';
import cliArgs from './cli/args';
import fs from 'graceful-fs';
import stripBOM from 'strip-bom';
import HasteMap from 'jest-haste-map';
import path from 'path';
import Resolver from 'jest-resolve';
import ScriptTransformer from './ScriptTransformer';
import shouldInstrument from './shouldInstrument';
import cliArgs from './cli/args';
import stripBOM from 'strip-bom';

type Module = {|
children?: Array<any>,
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-snapshot/src/__tests__/utils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

jest.mock('fs');

const fs = require('fs');
const path = require('path');
const chalk = require('chalk');
Expand Down
2 changes: 1 addition & 1 deletion packages/jest/bin/jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

import 'jest-cli/bin/jest';
require('jest-cli/bin/jest');
14 changes: 7 additions & 7 deletions packages/pretty-format/perf/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

import util from 'util';

import chalk from 'chalk';
import React from 'react';
import ReactTestRenderer from 'react-test-renderer';
import leftPad from 'left-pad';
import prettyFormat from '../build';
import ReactTestComponent from '../build/plugins/ReactTestComponent';
import worldGeoJson from './world.geo.json';
const chalk = require('chalk');
const React = require('react');
const ReactTestRenderer = require('react-test-renderer');
const leftPad = require('left-pad');
const prettyFormat = require('../build');
const ReactTestComponent = require('../build/plugins/ReactTestComponent');
const worldGeoJson = require('./world.geo.json');

const NANOSECONDS = 1000000000;
let TIMES_TO_RUN = 100000;
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,13 @@ babel-plugin-transform-flow-strip-types@^6.18.0, babel-plugin-transform-flow-str
babel-plugin-syntax-flow "^6.18.0"
babel-runtime "^6.22.0"

babel-plugin-transform-inline-imports-commonjs@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-inline-imports-commonjs/-/babel-plugin-transform-inline-imports-commonjs-1.2.0.tgz#20c7d192bafc54c8727386e3387d8ee4ef19e6a5"
dependencies:
babel-plugin-transform-strict-mode "^6.8.0"
builtin-modules "^1.1.1"

babel-plugin-transform-object-assign@^6.5.0:
version "6.22.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-assign/-/babel-plugin-transform-object-assign-6.22.0.tgz#f99d2f66f1a0b0d498e346c5359684740caa20ba"
Expand Down Expand Up @@ -664,7 +671,7 @@ babel-plugin-transform-runtime@^6.23.0:
dependencies:
babel-runtime "^6.22.0"

babel-plugin-transform-strict-mode@^6.24.1:
babel-plugin-transform-strict-mode@^6.24.1, babel-plugin-transform-strict-mode@^6.8.0:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758"
dependencies:
Expand Down