Skip to content

Commit c9aaa2f

Browse files
LinusBorghaoqunjiang
authored andcommitted
fix(cli-plugin-unit-jest): When using TS & Babel, make ts-jest use babelConfig (#3107)
* fix(cli-plugin-unit-jest): use ts-jest babelConfig When using Typescript and Babel, ts-jest should use babel to transform result for correct JSX transforms close #3100 * refactor: write generator a bit differently. previous way could end up with ugly `global: undefined` when not using babel
1 parent d86b9d4 commit c9aaa2f

File tree

1 file changed

+8
-0
lines changed
  • packages/@vue/cli-plugin-unit-jest/generator

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ const applyTS = module.exports.applyTS = (api, invoking) => {
8888
})
8989
if (api.hasPlugin('babel')) {
9090
api.extendPackage({
91+
jest: {
92+
global: {
93+
'ts-jest': {
94+
// we need babel to transpile JSX
95+
babelConfig: true
96+
}
97+
}
98+
},
9199
devDependencies: {
92100
// this is for now necessary to force ts-jest and vue-jest to use babel 7
93101
'babel-core': '7.0.0-bridge.0'

0 commit comments

Comments
 (0)