File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
packages/@vue/cli-plugin-unit-jest/migrator Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 1
1
/** @param {import('@vue/cli/lib/MigratorAPI') } api MigratorAPI */
2
- module . exports = ( api ) => {
2
+ module . exports = ( api , options , rootOptions ) => {
3
+ const isVue3 = rootOptions && rootOptions . vueVersion === '3'
4
+
3
5
api . extendPackage ( pkg => {
4
6
const newDevDeps = {
5
7
'jest' : '^27.1.0'
@@ -12,8 +14,12 @@ module.exports = (api) => {
12
14
}
13
15
14
16
if ( ! allDeps [ 'vue-jest' ] ) {
15
- // Likely a Vue 2 project, and uses the builtin preset.
16
- newDevDeps [ '@vue/vue3-jest' ] = '^27.0.0-alpha.1'
17
+ // Likely from @vue /cli@4
18
+ if ( isVue3 ) {
19
+ newDevDeps [ '@vue/vue3-jest' ] = '^27.0.0-alpha.3'
20
+ } else {
21
+ newDevDeps [ '@vue/vue2-jest' ] = '^27.0.0-alpha.3'
22
+ }
17
23
}
18
24
19
25
if ( allDeps [ '@vue/cli-plugin-typescript' ] && ! allDeps [ 'ts-jest' ] ) {
You can’t perform that action at this time.
0 commit comments