Closed lanxisama closed 3 years ago
"babel-jest": "^26.6.3", "vue": "^2.5.22", "vue-jest": "4.0.1",
// jest.config.js module.exports = { collectCoverageFrom: ['src/**/*.ts', 'src/**/*.vue'], coverageDirectory: 'coverage', coverageReporters: ['text', 'lcov'], transform: { // '^.+\\.js$': 'babel-jest', '^.+\\.js$':"<rootDir>/node_modules/babel-jest", '^.+\\.vue$': 'vue-jest', '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub', }, preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel', globals: { 'vue-jest': { experimentalCSSCompile: true, hideStyleWarn: true, pug: { doctype: 'html' }, }, }, setupFiles: ['jest-canvas-mock'], setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'], testMatch: ['**/__tests__/**/*.[jt]s?(x)'], transformIgnorePatterns: ['/node_modules/(?!.+.css)'], moduleNameMapper: { '^@/tests/(.*)$': '<rootDir>/tests/$1', '^@/(.*)$': '<rootDir>/src/$1', }, // resolver: '<rootDir>/tests/jest-resolver.js' };
when I run vue-cli-service test:unit --coverage has some error in console
` Running coverage on untested files...Failed to collect coverage from src/FreeReadingPageController.vue ERROR: [vue-jest] Error: Vue template compilation failed
I use pug in vue template
`
@lanxisama Have you managed to resolve this?
when I run vue-cli-service test:unit --coverage has some error in console
` Running coverage on untested files...Failed to collect coverage from src/FreeReadingPageController.vue ERROR: [vue-jest] Error: Vue template compilation failed
I use pug in vue template
`