We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c71ab1e commit 0d0a485Copy full SHA for 0d0a485
packages/@vue/cli-plugin-unit-jest/migrator/index.js
@@ -1,5 +1,7 @@
1
/** @param {import('@vue/cli/lib/MigratorAPI')} api MigratorAPI */
2
-module.exports = (api) => {
+module.exports = (api, options, rootOptions) => {
3
+ const isVue3 = rootOptions && rootOptions.vueVersion === '3'
4
+
5
api.extendPackage(pkg => {
6
const newDevDeps = {
7
'jest': '^27.1.0'
@@ -12,8 +14,12 @@ module.exports = (api) => {
12
14
}
13
15
16
if (!allDeps['vue-jest']) {
- // Likely a Vue 2 project, and uses the builtin preset.
- 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
+ }
23
24
25
if (allDeps['@vue/cli-plugin-typescript'] && !allDeps['ts-jest']) {
0 commit comments