Skip to content

Commit

Permalink
Fix Node.js 4 support (#5142)
Browse files Browse the repository at this point in the history
* Fix Node.js 4 support

* Use Babel to fix spread operator for Node.js 4

* Fix apply removal
  • Loading branch information
ai authored and cpojer committed Dec 21, 2017
1 parent 1521c51 commit 72983d4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
1 change: 1 addition & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"transform-flow-strip-types",
"transform-es2015-destructuring",
"transform-es2015-parameters",
"transform-es2015-spread",
"transform-async-to-generator",
"transform-strict-mode",
["transform-es2015-modules-commonjs", {"allowTopLevelThis": true}]
Expand Down
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-destructuring": "^6.23.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-plugin-transform-es2015-parameters": "^6.23.0",
"babel-plugin-transform-es2015-spread": "^6.22.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",
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-config/src/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ const buildTestPathPattern = (argv: Argv): string => {
const patterns = [];

if (argv._) {
patterns.push.apply(patterns, argv._);
patterns.push(...argv._);
}
if (argv.testPathPattern) {
patterns.push.apply(patterns, argv.testPathPattern);
patterns.push(...argv.testPathPattern);
}

const testPathPattern = patterns.map(replacePathSepForRegex).join('|');
Expand Down
8 changes: 4 additions & 4 deletions packages/jest-editor-support/src/Runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ export default class Runner extends EventEmitter {

runJestWithUpdateForSnapshots(completion: any, args: string[]) {
const defaultArgs = ['--updateSnapshot'];
const updateProcess = this._createProcess(
this.workspace,
[].concat(defaultArgs).concat(args ? args : []),
);
const updateProcess = this._createProcess(this.workspace, [
...defaultArgs,
...(args ? args : []),
]);
updateProcess.on('close', () => {
completion();
});
Expand Down
10 changes: 4 additions & 6 deletions packages/jest-resolve/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,13 @@ class Resolver {
const defaultPlatform = this._options.defaultPlatform;
const extensions = this._options.extensions.slice();
if (this._supportsNativePlatform()) {
extensions.unshift.apply(
extensions,
this._options.extensions.map(ext => '.' + NATIVE_PLATFORM + ext),
extensions.unshift(
...this._options.extensions.map(ext => '.' + NATIVE_PLATFORM + ext),
);
}
if (defaultPlatform) {
extensions.unshift.apply(
extensions,
this._options.extensions.map(ext => '.' + defaultPlatform + ext),
extensions.unshift(
...this._options.extensions.map(ext => '.' + defaultPlatform + ext),
);
}

Expand Down

0 comments on commit 72983d4

Please sign in to comment.