jest.config.js 879 B

123456789101112131415161718192021222324252627
  1. module.exports = {
  2. verbose: true,
  3. moduleFileExtensions: ['js', 'jsx', 'json', 'vue'],
  4. // transformIgnorePatterns: [
  5. // 'node_modules/(?!(babel-jest|jest-vue-preprocessor)/)'
  6. // ],
  7. transform: {
  8. '^.+\\.vue$': 'vue-jest',
  9. '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
  10. '^.+\\.jsx?$': 'babel-jest'
  11. },
  12. moduleNameMapper: {
  13. '^@/(.*)$': '<rootDir>/src/$1'
  14. },
  15. snapshotSerializers: ['jest-serializer-vue'],
  16. testMatch: [
  17. '**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'
  18. ],
  19. collectCoverageFrom: ['src/utils/**/*.{js,vue}', '!src/utils/auth.js', '!src/utils/request.js', 'src/components/**/*.{js,vue}'],
  20. coverageDirectory: '<rootDir>/tests/unit/coverage',
  21. // 'collectCoverage': true,
  22. 'coverageReporters': [
  23. 'lcov',
  24. 'text-summary'
  25. ],
  26. testURL: 'http://localhost/'
  27. }