Skip to content

Commit

Permalink
fix: should not inject babel-core shim if babel plugin is not used
Browse files Browse the repository at this point in the history
close #1424
  • Loading branch information
yyx990803 committed Jun 1, 2018
1 parent be5526e commit a91d022
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/@vue/cli-plugin-unit-jest/generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ module.exports = api => {
}

if (!api.hasPlugin('typescript')) {
jestConfig.transform['^.+\\.jsx?$'] = 'babel-jest'
api.extendPackage({
devDependencies: {
'babel-jest': '^22.4.3',
// this is for now necessary to force babel-jest and vue-jest to use babel 7
'babel-core': '7.0.0-bridge.0'
}
})
if (api.hasPlugin('babel')) {
jestConfig.transform['^.+\\.jsx?$'] = 'babel-jest'
api.extendPackage({
devDependencies: {
'babel-jest': '^22.4.3',
// this is for now necessary to force babel-jest and vue-jest to use babel 7
'babel-core': '7.0.0-bridge.0'
}
})
}
} else {
jestConfig.moduleFileExtensions.unshift('ts', 'tsx')
jestConfig.transform['^.+\\.tsx?$'] = 'ts-jest'
Expand Down

0 comments on commit a91d022

Please sign in to comment.