jest.config.mjs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. '^.+\\.(vue)$': 'vue-jest',
  21. },
  22. transformIgnorePatterns: ['<rootDir>/tests/__mocks__/', '/node_modules/'],
  23. // A map from regular expressions to module names that allow to stub out resources with a single module
  24. moduleNameMapper: {
  25. '\\.(vs|fs|vert|frag|glsl|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
  26. '<rootDir>/tests/__mocks__/fileMock.ts',
  27. '\\.(sass|s?css|less)$': '<rootDir>/tests/__mocks__/styleMock.ts',
  28. '\\?worker$': '<rootDir>/tests/__mocks__/workerMock.ts',
  29. '^/@/(.*)$': '<rootDir>/src/$1',
  30. },
  31. testEnvironment: 'jsdom',
  32. verbose: true,
  33. collectCoverage: false,
  34. coverageDirectory: 'coverage',
  35. collectCoverageFrom: ['src/**/*.{js,ts,vue}'],
  36. coveragePathIgnorePatterns: ['^.+\\.d\\.ts$'],
  37. };