jest.config.mjs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. export default {
  2. preset: 'ts-jest',
  3. roots: ['<rootDir>/tests/'],
  4. clearMocks: true,
  5. moduleDirectories: ['node_modules', 'src'],
  6. moduleFileExtensions: ['js', 'ts', 'vue', 'tsx', 'jsx', 'json', 'node'],
  7. modulePaths: ['<rootDir>/src', '<rootDir>/node_modules'],
  8. testMatch: [
  9. '**/tests/**/*.[jt]s?(x)',
  10. '**/?(*.)+(spec|test).[tj]s?(x)',
  11. '(/__tests__/.*|(\\.|/)(test|spec))\\.(js|ts)$',
  12. ],
  13. testPathIgnorePatterns: [
  14. '<rootDir>/tests/server/',
  15. '<rootDir>/tests/__mocks__/',
  16. '/node_modules/',
  17. ],
  18. transform: {
  19. '^.+\\.tsx?$': 'ts-jest',
  20. },
  21. transformIgnorePatterns: ['<rootDir>/tests/__mocks__/', '/node_modules/'],
  22. // A map from regular expressions to module names that allow to stub out resources with a single module
  23. moduleNameMapper: {
  24. '\\.(vs|fs|vert|frag|glsl|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
  25. '<rootDir>/tests/__mocks__/fileMock.ts',
  26. '\\.(sass|s?css|less)$': '<rootDir>/tests/__mocks__/styleMock.ts',
  27. '\\?worker$': '<rootDir>/tests/__mocks__/workerMock.ts',
  28. '^/@/(.*)$': '<rootDir>/src/$1',
  29. },
  30. testEnvironment: 'jsdom',
  31. verbose: true,
  32. collectCoverage: false,
  33. coverageDirectory: 'coverage',
  34. collectCoverageFrom: ['src/**/*.{js,ts,vue}'],
  35. coveragePathIgnorePatterns: ['^.+\\.d\\.ts$'],
  36. };