jest.config.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. // Indicates whether each individual test should be reported during the run
  9. verbose: true,
  10. moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
  11. projects: [
  12. {
  13. displayName: 'server',
  14. transform: {
  15. '^.+\\.(t|j)sx?$': '@swc-node/jest',
  16. },
  17. rootDir: '.',
  18. roots: ['<rootDir>'],
  19. testMatch: ['<rootDir>/test/integration/**/*.test.ts', '<rootDir>/test/integration/**/*.test.js'],
  20. // https://regex101.com/r/jTaxYS/1
  21. modulePathIgnorePatterns: ['<rootDir>/test/integration/*.*/v5(..*)*.[t|j]s'],
  22. testEnvironment: 'node',
  23. globalSetup: '<rootDir>/test/integration/global-setup.js',
  24. globalTeardown: '<rootDir>/test/integration/global-teardown.js',
  25. setupFilesAfterEnv: ['<rootDir>/test/integration/setup.js'],
  26. // Automatically clear mock calls and instances between every test
  27. clearMocks: true,
  28. moduleNameMapper: MODULE_NAME_MAPPING,
  29. },
  30. {
  31. displayName: 'server-v5',
  32. transform: {
  33. '^.+\\.(t|j)sx?$': '@swc-node/jest',
  34. },
  35. rootDir: '.',
  36. roots: ['<rootDir>'],
  37. testMatch: ['<rootDir>/test/integration/**/v5.*.test.ts', '<rootDir>/test/integration/**/v5.*.test.js'],
  38. testEnvironment: 'node',
  39. globalSetup: '<rootDir>/test/integration/global-setup.js',
  40. globalTeardown: '<rootDir>/test/integration/global-teardown.js',
  41. setupFilesAfterEnv: ['<rootDir>/test/integration/setup.js'],
  42. // Automatically clear mock calls and instances between every test
  43. clearMocks: true,
  44. moduleNameMapper: MODULE_NAME_MAPPING,
  45. },
  46. ],
  47. // Automatically clear mock calls and instances between every test
  48. clearMocks: true,
  49. // Indicates whether the coverage information should be collected while executing the test
  50. collectCoverage: true,
  51. // An array of glob patterns indicating a set of files for which coverage information should be collected
  52. // collectCoverageFrom: undefined,
  53. // The directory where Jest should output its coverage files
  54. coverageDirectory: 'coverage',
  55. // An array of regexp pattern strings used to skip coverage collection
  56. coveragePathIgnorePatterns: [
  57. 'index.ts',
  58. '/config/',
  59. '/resource/',
  60. '/node_modules/',
  61. ],
  62. };