Skip to content

Commit 99761b3

Browse files
committed
fix(jest): make sure jest tests work without babel
close vuejs#2040
1 parent c5ea39a commit 99761b3

File tree

1 file changed

+5
-3
lines changed
  • packages/@vue/cli-plugin-unit-jest/generator

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@ module.exports = (api, _, __, invoking) => {
5656
}
5757
})
5858
} else {
59-
api.extendPackage({
60-
babel: {
59+
// Jest's shipped babel-jest still uses babel 6,
60+
// so we cannot use extendPackage which renders babel.config.js.
61+
api.render(files => {
62+
files['.babelrc'] = JSON.stringify({
6163
plugins: ['transform-es2015-modules-commonjs']
62-
}
64+
}, null, 2)
6365
})
6466
}
6567
} else {

0 commit comments

Comments
 (0)