jest.config.js 778 B

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