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

Fix Node.js 4 support #5142

Merged
merged 3 commits into from
Dec 21, 2017
Merged
Show file tree
Hide file tree
Changes from 2 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
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
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async function jasmine2(
const originalIt = environment.global.it;
environment.global.it = (...args) => {
const stack = callsites()[1];
const it = originalIt(...args);
const it = originalIt.apply(this, ...args);
Copy link
Member

Choose a reason for hiding this comment

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

we don't need the apply, do we?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops. fix was pushed


it.result.__callsite = stack;

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