Skip to content

Commit 791fa28

Browse files
committed
chore: should output meaningful error message for missing vue-jest dep
follow up of #6418
1 parent aad72cf commit 791fa28

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: packages/@vue/cli-plugin-unit-jest/presets/default/jest-preset.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
let vueJest = null
2+
try {
3+
vueJest = require.resolve('vue-jest')
4+
} catch (e) {
5+
throw new Error('Cannot resolve "vue-jest" module. Please make sure you have installed "vue-jest" as a dev dependency.')
6+
}
7+
18
module.exports = {
29
moduleFileExtensions: [
310
'js',
@@ -8,7 +15,7 @@ module.exports = {
815
],
916
transform: {
1017
// process *.vue files with vue-jest
11-
'^.+\\.vue$': require.resolve('vue-jest'),
18+
'^.+\\.vue$': vueJest,
1219
'.+\\.(css|styl|less|sass|scss|jpg|jpeg|png|svg|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
1320
require.resolve('jest-transform-stub'),
1421
'^.+\\.jsx?$': require.resolve('babel-jest')

0 commit comments

Comments
 (0)