jest.config.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. moduleNameMapper: MODULE_NAME_MAPPING,
  11. // Automatically clear mock calls and instances between every test
  12. clearMocks: true,
  13. // Indicates whether the coverage information should be collected while executing the test
  14. collectCoverage: true,
  15. // An array of glob patterns indicating a set of files for which coverage information should be collected
  16. // collectCoverageFrom: undefined,
  17. // The directory where Jest should output its coverage files
  18. coverageDirectory: 'coverage',
  19. // An array of regexp pattern strings used to skip coverage collection
  20. coveragePathIgnorePatterns: [
  21. '/node_modules/',
  22. ],
  23. // An object that configures minimum threshold enforcement for coverage results
  24. // TODO: activate -- 2020.03.24 Yuki Takei
  25. // coverageThreshold: {
  26. // global: {
  27. // branches: 70,
  28. // functions: 70,
  29. // lines: 70,
  30. // statements: 70,
  31. // },
  32. // },
  33. // An array of file extensions your modules use
  34. moduleFileExtensions: [
  35. 'js',
  36. 'json',
  37. 'jsx',
  38. 'ts',
  39. 'tsx',
  40. 'node',
  41. ],
  42. // The test environment that will be used for testing
  43. testEnvironment: 'node',
  44. // The glob patterns Jest uses to detect test files
  45. testMatch: [
  46. '**/test/**/__tests__/**/*.[jt]s?(x)',
  47. '**/test/**/?(*.)+(spec|test).[jt]s?(x)',
  48. ],
  49. };