Skip to content

Instantly share code, notes, and snippets.

@agcty
Last active May 17, 2019
Embed
What would you like to do?
Jest config
module.exports = {
// tell Jest to handle `*.vue` files
moduleFileExtensions: ["js", "json", "vue"],
watchman: false,
moduleNameMapper: {
"^~/(.*)$": "<rootDir>/$1",
"^~~/(.*)$": "<rootDir>/$1",
"^@/(.*)$": "<rootDir>/$1"
},
transform: {
// process js with `babel-jest`
"^.+\\.js$": "<rootDir>/node_modules/babel-jest",
// process `*.vue` files with `vue-jest`
".*\\.(vue)$": "<rootDir>/node_modules/vue-jest"
},
snapshotSerializers: ["<rootDir>/node_modules/jest-serializer-vue"],
collectCoverage: true,
collectCoverageFrom: [
"<rootDir>/components/**/*.vue",
"<rootDir>/pages/*.vue"
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment