jest.conf.js 667 B

123456789101112131415161718192021222324252627
  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. snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
  17. setupFiles: ['<rootDir>/test/unit/setup'],
  18. mapCoverage: true,
  19. coverageDirectory: '<rootDir>/test/unit/coverage',
  20. collectCoverageFrom: [
  21. 'src/**/*.{js,vue}',
  22. '!src/main.js',
  23. '!src/router/index.js',
  24. '!**/node_modules/**'
  25. ]
  26. }