jest.config.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // For a detailed explanation regarding each configuration property, visit:
  2. // https://jestjs.io/docs/en/configuration.html
  3. // https://kulshekhar.github.io/ts-jest/user/config/
  4. const MODULE_NAME_MAPPING = {
  5. '^\\^/(.+)$': '<rootDir>/$1',
  6. '^~/(.+)$': '<rootDir>/src/$1',
  7. };
  8. module.exports = {
  9. // Indicates whether each individual test should be reported during the run
  10. verbose: true,
  11. preset: 'ts-jest/presets/js-with-ts',
  12. globalSetup: '<rootDir>/src/test/global-setup.js',
  13. globalTeardown: '<rootDir>/src/test/global-teardown.js',
  14. projects: [
  15. {
  16. displayName: 'server',
  17. preset: 'ts-jest/presets/js-with-ts',
  18. rootDir: '.',
  19. roots: ['<rootDir>/src'],
  20. testEnvironment: 'node',
  21. setupFilesAfterEnv: ['<rootDir>/src/test/setup.js'],
  22. testMatch: ['<rootDir>/src/test/**/*.test.ts', '<rootDir>/src/test/**/*.test.js'],
  23. // Automatically clear mock calls and instances between every test
  24. clearMocks: true,
  25. moduleNameMapper: MODULE_NAME_MAPPING,
  26. },
  27. // {
  28. // displayName: 'client',
  29. // rootDir: '.',
  30. // testMatch: ['<rootDir>/src/test/client/**/*.test.js'],
  31. // },
  32. ],
  33. // Indicates whether the coverage information should be collected while executing the test
  34. // collectCoverage: false,
  35. // An array of glob patterns indicating a set of files for which coverage information should be collected
  36. collectCoverageFrom: [
  37. 'src/client/**/*.js',
  38. 'src/lib/**/*.js',
  39. 'src/migrations/**/*.js',
  40. 'src/server/**/*.js',
  41. ],
  42. // The directory where Jest should output its coverage files
  43. coverageDirectory: 'coverage',
  44. };