Skip to content

Instantly share code, notes, and snippets.

@agcty
Last active May 17, 2019 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agcty/0dbbba5b625c5e49dc1ff7e98470d29d to your computer and use it in GitHub Desktop.
Save agcty/0dbbba5b625c5e49dc1ff7e98470d29d to your computer and use it in GitHub Desktop.
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