我设置了以下玩笑配置,以生成有关项目中Vue文件的覆盖率报告
module.exports = {
"collectCoverage": true,
"collectCoverageFrom": [
"public/client/app/**/*.vue",
"!**/node_modules/**"
],
moduleFileExtensions: [
"js",
"jsx",
"json",
"vue"
],
transform: {
"^.+\\.vue$": "vue-jest",
".+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$": "jest-transform-stub",
"^.+\\.jsx?$": "babel-jest"
},
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/public/client/$1"
},
snapshotSerializers: [
"jest-serializer-vue"
],
testMatch: [
"**/__tests__/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"
],
testURL: "http://localhost/"
};