1 |
|
2 | 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'
|
8 | }
|
9 |
|
10 | const allDeps = {
|
11 | ...pkg.dependencies,
|
12 | ...pkg.devDependencies,
|
13 | ...pkg.optionalDependencies
|
14 | }
|
15 |
|
16 | if (!allDeps['vue-jest']) {
|
17 |
|
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']) {
|
26 | newDevDeps['ts-jest'] = '^27.0.4'
|
27 | }
|
28 |
|
29 | const toMerge = { devDependencies: newDevDeps }
|
30 | return toMerge
|
31 | })
|
32 | }
|