jest.config.js 1.5 KB

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