Skip to content

Instantly share code, notes, and snippets.

@brandonaaskov
Last active January 18, 2020 23:09
Show Gist options
  • Save brandonaaskov/9349a9693b9e405b5a903667d4cf6e0b to your computer and use it in GitHub Desktop.
Save brandonaaskov/9349a9693b9e405b5a903667d4cf6e0b to your computer and use it in GitHub Desktop.
Jest config file that adds one-time setup file before test suites start running
module.exports = {
globalSetup: "<rootDir>/jest.setup.js", // this line is the only change here
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/$1",
"^~/(.*)$": "<rootDir>/$1",
"^vue$": "vue/dist/vue.common.js"
},
moduleFileExtensions: ["js", "vue", "json"],
testEnvironment: "jsdom",
transform: {
"^.+\\.js$": "babel-jest",
".*\\.(vue)$": "vue-jest"
},
collectCoverage: true,
collectCoverageFrom: ["<rootDir>/**/*.(vue|js)"],
forceExit: !!process.env.CI // almost every CI platform sets this by default
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment