Skip to content

Commit adae150

Browse files
dnalborczykhzoo
authored andcommitted
update jest (major), babel-jest (major) (#8341)
updated `jest` and `babel-jest` to `v23` fixed breaking change in `jest`: - https://github.com/facebook/jest/blob/master/CHANGELOG.md#2300 - jestjs/jest#5558 _edit:_ forgot to mention. test runner fix is based on: https://github.com/babel/babel/blob/master/packages/babel-parser/test/helpers/runFixtureTests.js#L11
1 parent c8038f6 commit adae150

File tree

4 files changed

+351
-288
lines changed

4 files changed

+351
-288
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@babel/register": "7.0.0-beta.52",
2020
"babel-core": "^7.0.0-0",
2121
"babel-eslint": "^8.2.6",
22-
"babel-jest": "^22.4.1",
22+
"babel-jest": "^23.4.0",
2323
"babel-loader": "8.0.0-beta.0",
2424
"babel-plugin-transform-charcodes": "^0.1.0",
2525
"browserify": "^13.1.1",
@@ -44,7 +44,7 @@
4444
"gulp-util": "^3.0.7",
4545
"gulp-watch": "^5.0.0",
4646
"husky": "^0.14.3",
47-
"jest": "^22.4.2",
47+
"jest": "^23.4.1",
4848
"lerna": "^2.11.0",
4949
"lerna-changelog": "^0.5.0",
5050
"lint-staged": "^6.0.1",

packages/babel-generator/test/index.js

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -362,36 +362,38 @@ const suites = fixtures(`${__dirname}/fixtures`);
362362
suites.forEach(function(testSuite) {
363363
describe("generation/" + testSuite.title, function() {
364364
testSuite.tests.forEach(function(task) {
365-
it(
365+
const testFn = task.disabled ? it.skip : it;
366+
367+
testFn(
366368
task.title,
367-
!task.disabled &&
368-
function() {
369-
const expected = task.expect;
370-
const actual = task.actual;
371-
const actualCode = actual.code;
372-
373-
if (actualCode) {
374-
const actualAst = parse(actualCode, {
375-
filename: actual.loc,
376-
plugins: task.options.plugins || [],
377-
strictMode: false,
378-
sourceType: "module",
379-
});
380-
const result = generate(actualAst, task.options, actualCode);
381-
382-
if (
383-
!expected.code &&
384-
result.code &&
385-
fs.statSync(path.dirname(expected.loc)).isDirectory() &&
386-
!process.env.CI
387-
) {
388-
console.log(`New test file created: ${expected.loc}`);
389-
fs.writeFileSync(expected.loc, result.code);
390-
} else {
391-
expect(result.code).toBe(expected.code);
392-
}
369+
370+
function() {
371+
const expected = task.expect;
372+
const actual = task.actual;
373+
const actualCode = actual.code;
374+
375+
if (actualCode) {
376+
const actualAst = parse(actualCode, {
377+
filename: actual.loc,
378+
plugins: task.options.plugins || [],
379+
strictMode: false,
380+
sourceType: "module",
381+
});
382+
const result = generate(actualAst, task.options, actualCode);
383+
384+
if (
385+
!expected.code &&
386+
result.code &&
387+
fs.statSync(path.dirname(expected.loc)).isDirectory() &&
388+
!process.env.CI
389+
) {
390+
console.log(`New test file created: ${expected.loc}`);
391+
fs.writeFileSync(expected.loc, result.code);
392+
} else {
393+
expect(result.code).toBe(expected.code);
393394
}
394-
},
395+
}
396+
},
395397
);
396398
});
397399
});

packages/babel-helper-transform-fixture-test-runner/src/index.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -345,44 +345,44 @@ export default function(
345345
continue;
346346
}
347347

348-
it(
348+
const testFn = task.disabled ? it.skip : it;
349+
350+
testFn(
349351
task.title,
350-
!task.disabled &&
351-
function() {
352-
function runTask() {
353-
run(task);
354-
}
355352

356-
defaults(task.options, {
357-
sourceMap: !!(task.sourceMappings || task.sourceMap),
358-
});
353+
function() {
354+
function runTask() {
355+
run(task);
356+
}
359357

360-
extend(task.options, taskOpts);
358+
defaults(task.options, {
359+
sourceMap: !!(task.sourceMappings || task.sourceMap),
360+
});
361361

362-
if (dynamicOpts) dynamicOpts(task.options, task);
362+
extend(task.options, taskOpts);
363363

364-
const throwMsg = task.options.throws;
365-
if (throwMsg) {
366-
// internal api doesn't have this option but it's best not to pollute
367-
// the options object with useless options
368-
delete task.options.throws;
364+
if (dynamicOpts) dynamicOpts(task.options, task);
369365

370-
assert.throws(runTask, function(err) {
371-
return (
372-
throwMsg === true || err.message.indexOf(throwMsg) >= 0
373-
);
374-
});
375-
} else {
376-
if (task.exec.code) {
377-
const result = run(task);
378-
if (result && typeof result.then === "function") {
379-
return result;
380-
}
381-
} else {
382-
runTask();
366+
const throwMsg = task.options.throws;
367+
if (throwMsg) {
368+
// internal api doesn't have this option but it's best not to pollute
369+
// the options object with useless options
370+
delete task.options.throws;
371+
372+
assert.throws(runTask, function(err) {
373+
return throwMsg === true || err.message.indexOf(throwMsg) >= 0;
374+
});
375+
} else {
376+
if (task.exec.code) {
377+
const result = run(task);
378+
if (result && typeof result.then === "function") {
379+
return result;
383380
}
381+
} else {
382+
runTask();
384383
}
385-
},
384+
}
385+
},
386386
);
387387
}
388388
});

0 commit comments

Comments
 (0)