jest.config.js 1.6 KB

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