jest.config.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. projects: [
  8. {
  9. displayName: 'server',
  10. testEnvironment: 'node',
  11. rootDir: '.',
  12. setupFilesAfterEnv: ['<rootDir>/src/test/setup.js'],
  13. testMatch: ['<rootDir>/src/test/**/*.test.js'],
  14. // Automatically clear mock calls and instances between every test
  15. clearMocks: true,
  16. // A map from regular expressions to module names that allow to stub out resources with a single module
  17. moduleNameMapper: {
  18. '@root/(.+)': '<rootDir>/$1',
  19. '@commons/(.+)': '<rootDir>/src/lib/$1',
  20. '@server/(.+)': '<rootDir>/src/server/$1',
  21. '@alias/logger': '<rootDir>/src/lib/service/logger',
  22. // -- doesn't work with unknown error -- 2019.06.19 Yuki Takei
  23. // debug: '<rootDir>/src/lib/service/logger/alias-for-debug',
  24. },
  25. },
  26. // {
  27. // displayName: 'client',
  28. // rootDir: '.',
  29. // testMatch: ['<rootDir>/src/test/client/**/*.test.js'],
  30. // },
  31. ],
  32. // Indicates whether the coverage information should be collected while executing the test
  33. // collectCoverage: false,
  34. // An array of glob patterns indicating a set of files for which coverage information should be collected
  35. collectCoverageFrom: [
  36. 'src/client/**/*.js',
  37. 'src/lib/**/*.js',
  38. 'src/migrations/**/*.js',
  39. 'src/server/**/*.js',
  40. ],
  41. // The directory where Jest should output its coverage files
  42. coverageDirectory: 'coverage',
  43. };