Skip to content

Commit

Permalink
fix(cli-plugin-unit-jest): When using TS & Babel, make ts-jest use ba…
Browse files Browse the repository at this point in the history
…belConfig (vuejs#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 vuejs#3100

* refactor:  write generator a bit differently.

previous way could end up with ugly `global: undefined`
when not using babel
  • Loading branch information
LinusBorg authored and haoqunjiang committed Dec 29, 2018
1 parent d86b9d4 commit c9aaa2f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/@vue/cli-plugin-unit-jest/generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ const applyTS = module.exports.applyTS = (api, invoking) => {
})
if (api.hasPlugin('babel')) {
api.extendPackage({
jest: {
global: {
'ts-jest': {
// we need babel to transpile JSX
babelConfig: true
}
}
},
devDependencies: {
// this is for now necessary to force ts-jest and vue-jest to use babel 7
'babel-core': '7.0.0-bridge.0'
Expand Down

0 comments on commit c9aaa2f

Please sign in to comment.