Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0d0a485

Browse filesBrowse files
authored
fix(migrator): be aware of the project's vue version (#6794)
1 parent c71ab1e commit 0d0a485
Copy full SHA for 0d0a485

File tree

Expand file treeCollapse file tree

1 file changed

+9
-3
lines changed
Filter options
  • packages/@vue/cli-plugin-unit-jest/migrator
Expand file treeCollapse file tree

1 file changed

+9
-3
lines changed

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

Copy file name to clipboardExpand all lines: packages/@vue/cli-plugin-unit-jest/migrator/index.js
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/** @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+
35
api.extendPackage(pkg => {
46
const newDevDeps = {
57
'jest': '^27.1.0'
@@ -12,8 +14,12 @@ module.exports = (api) => {
1214
}
1315

1416
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+
}
1723
}
1824

1925
if (allDeps['@vue/cli-plugin-typescript'] && !allDeps['ts-jest']) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.