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

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

Lines changed: 8 additions & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy