Skip to content

Commit f395697

Browse files
committed
fix: revert accidentally committed jest related changes
1 parent 911fddb commit f395697

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

packages/@vue/cli-plugin-unit-jest/__tests__/jestGenerator.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ test('base', async () => {
2525

2626
// should inject babel-jest
2727
expect(pkg.devDependencies).toHaveProperty('babel-jest')
28+
// babel-core 6 -> 7 shim
29+
expect(pkg.devDependencies).toHaveProperty('babel-core')
2830
// eslint
2931
expect(files['tests/unit/.eslintrc.js']).toMatch('jest: true')
3032

packages/@vue/cli-plugin-unit-jest/generator/index.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,22 @@ module.exports = (api, _, __, invoking) => {
5454
if (api.hasPlugin('babel')) {
5555
api.extendPackage({
5656
devDependencies: {
57-
'babel-jest': '^24.7.1'
57+
'babel-jest': '^23.6.0',
58+
// this is for now necessary to force babel-jest and vue-jest to use babel 7
59+
'babel-core': '7.0.0-bridge.0'
5860
}
5961
})
6062
} else {
61-
api.extendPackage({
62-
babel: {
63-
plugins: ['transform-es2015-modules-commonjs']
64-
}
63+
// Jest's shipped babel-jest still uses babel 6,
64+
// so we cannot use extendPackage which renders babel.config.js.
65+
api.render(files => {
66+
files['.babelrc'] = JSON.stringify(
67+
{
68+
plugins: ['transform-es2015-modules-commonjs']
69+
},
70+
null,
71+
2
72+
)
6573
})
6674
}
6775
} else {

packages/@vue/cli-plugin-unit-jest/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@
2323
"access": "public"
2424
},
2525
"dependencies": {
26-
"@babel/core": "^7.4.4",
27-
"@babel/plugin-transform-modules-commonjs": "^7.4.4",
2826
"@vue/cli-shared-utils": "^3.6.0",
2927
"babel-jest": "^24.7.1",
28+
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
3029
"jest": "^24.7.1",
3130
"jest-serializer-vue": "^2.0.2",
3231
"jest-transform-stub": "^2.0.0",

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3507,7 +3507,7 @@ babel-plugin-syntax-object-rest-spread@^6.8.0:
35073507
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5"
35083508
integrity sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=
35093509

3510-
babel-plugin-transform-es2015-modules-commonjs@^6.26.0:
3510+
babel-plugin-transform-es2015-modules-commonjs@^6.26.0, babel-plugin-transform-es2015-modules-commonjs@^6.26.2:
35113511
version "6.26.2"
35123512
resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz#58a793863a9e7ca870bdc5a881117ffac27db6f3"
35133513
integrity sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q==

0 commit comments

Comments
 (0)