jest.conf.js 729 B

123456789101112131415161718192021222324252627282930
  1. const path = require('path')
  2. module.exports = {
  3. rootDir: path.resolve(__dirname, '../../'),
  4. moduleFileExtensions: [
  5. 'js',
  6. 'json',
  7. 'vue'
  8. ],
  9. moduleNameMapper: {
  10. '^@/(.*)$': '<rootDir>/src/$1'
  11. },
  12. transform: {
  13. '^.+\\.js$': '<rootDir>/node_modules/babel-jest',
  14. '.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
  15. },
  16. testPathIgnorePatterns: [
  17. '<rootDir>/test/e2e'
  18. ],
  19. snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
  20. setupFiles: ['<rootDir>/test/unit/setup'],
  21. mapCoverage: true,
  22. coverageDirectory: '<rootDir>/test/unit/coverage',
  23. collectCoverageFrom: [
  24. 'src/**/*.{js,vue}',
  25. '!src/main.js',
  26. '!src/route.json/index.js',
  27. '!**/node_modules/**'
  28. ]
  29. }