jest.config.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // For a detailed explanation regarding each configuration property, visit:
  2. // https://jestjs.io/docs/en/configuration.html
  3. const MODULE_NAME_MAPPING = {
  4. '^~/(.+)$': '<rootDir>/src/$1',
  5. };
  6. module.exports = {
  7. transform: {
  8. '^.+\\.(js|jsx|ts|tsx)$': '@swc/jest',
  9. },
  10. transformIgnorePatterns: [],
  11. moduleNameMapper: MODULE_NAME_MAPPING,
  12. // Automatically clear mock calls and instances between every test
  13. clearMocks: true,
  14. // Indicates whether the coverage information should be collected while executing the test
  15. collectCoverage: true,
  16. // An array of glob patterns indicating a set of files for which coverage information should be collected
  17. // collectCoverageFrom: undefined,
  18. // The directory where Jest should output its coverage files
  19. coverageDirectory: 'coverage',
  20. // An array of regexp pattern strings used to skip coverage collection
  21. coveragePathIgnorePatterns: [
  22. '/node_modules/',
  23. ],
  24. // An object that configures minimum threshold enforcement for coverage results
  25. // TODO: activate -- 2020.03.24 Yuki Takei
  26. // coverageThreshold: {
  27. // global: {
  28. // branches: 70,
  29. // functions: 70,
  30. // lines: 70,
  31. // statements: 70,
  32. // },
  33. // },
  34. // An array of file extensions your modules use
  35. moduleFileExtensions: [
  36. 'js',
  37. 'json',
  38. 'jsx',
  39. 'ts',
  40. 'tsx',
  41. 'node',
  42. ],
  43. // The test environment that will be used for testing
  44. testEnvironment: 'node',
  45. // The glob patterns Jest uses to detect test files
  46. testMatch: [
  47. '**/test/**/__tests__/**/*.[jt]s?(x)',
  48. '**/test/**/?(*.)+(spec|test).[jt]s?(x)',
  49. ],
  50. };