jest.config.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // For a detailed explanation regarding each configuration property, visit:
  2. // https://jestjs.io/docs/en/configuration.html
  3. module.exports = {
  4. // Indicates whether each individual test should be reported during the run
  5. verbose: true,
  6. rootDir: '../',
  7. // Automatically clear mock calls and instances between every test
  8. clearMocks: true,
  9. // Automatically reset mock state between every test
  10. resetMocks: true,
  11. projects: [
  12. {
  13. displayName: 'server',
  14. testEnvironment: 'node',
  15. rootDir: '.',
  16. setupFilesAfterEnv: ['<rootDir>/src/test/setup.js'],
  17. testMatch: ['<rootDir>/src/test/**/*.test.js'],
  18. // A map from regular expressions to module names that allow to stub out resources with a single module
  19. moduleNameMapper: {
  20. '@root/(.+)': '<rootDir>/$1',
  21. '@commons/(.+)': '<rootDir>/src/lib/$1',
  22. '@server/(.+)': '<rootDir>/src/server/$1',
  23. '@alias/logger': '<rootDir>/src/lib/service/logger',
  24. // -- doesn't work with unknown error -- 2019.06.19 Yuki Takei
  25. // debug: '<rootDir>/src/lib/service/logger/alias-for-debug',
  26. },
  27. },
  28. // {
  29. // displayName: 'client',
  30. // rootDir: '.',
  31. // testMatch: ['<rootDir>/src/test/client/**/*.test.js'],
  32. // },
  33. ],
  34. // Indicates whether the coverage information should be collected while executing the test
  35. // collectCoverage: false,
  36. // An array of glob patterns indicating a set of files for which coverage information should be collected
  37. collectCoverageFrom: [
  38. 'src/client/**/*.js',
  39. 'src/lib/**/*.js',
  40. 'src/migrations/**/*.js',
  41. 'src/server/**/*.js',
  42. ],
  43. // The directory where Jest should output its coverage files
  44. coverageDirectory: 'coverage',
  45. };