jest.config.js 573 B

12345678910111213141516
  1. module.exports = {
  2. moduleFileExtensions: ['vue', 'js', 'ts'],
  3. preset: 'ts-jest',
  4. testEnvironment: 'jsdom',
  5. transform: {
  6. '^.+\\.vue$': 'vue-jest', // vue 文件用 vue-jest 转换
  7. '^.+\\.ts$': 'ts-jest' // ts 文件用 ts-jest 转换
  8. },
  9. // 匹配 __tests__ 目录下的 .js/.ts 文件 或其他目录下的 xx.test.js/ts xx.spec.js/ts
  10. testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(ts)$',
  11. //testRegex: '__tests__.action.spec.ts',
  12. // 支持源代码中相同的 `@` -> `src` 别名
  13. moduleNameMapper: {
  14. '^@/(.*)$': '<rootDir>/src/$1'
  15. }
  16. };