jest.config.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. rootDir: '../',
  13. roots: ['<rootDir>/src'],
  14. globalSetup: '<rootDir>/src/test/global-setup.js',
  15. globalTeardown: '<rootDir>/src/test/global-teardown.js',
  16. projects: [
  17. {
  18. displayName: 'server',
  19. preset: 'ts-jest/presets/js-with-ts',
  20. rootDir: '.',
  21. roots: ['<rootDir>/src'],
  22. testEnvironment: 'node',
  23. setupFilesAfterEnv: ['<rootDir>/src/test/setup.js'],
  24. testMatch: ['<rootDir>/src/test/**/*.test.ts', '<rootDir>/src/test/**/*.test.js'],
  25. // Automatically clear mock calls and instances between every test
  26. clearMocks: true,
  27. moduleNameMapper: MODULE_NAME_MAPPING,
  28. },
  29. // {
  30. // displayName: 'client',
  31. // rootDir: '.',
  32. // testMatch: ['<rootDir>/src/test/client/**/*.test.js'],
  33. // },
  34. ],
  35. // Indicates whether the coverage information should be collected while executing the test
  36. // collectCoverage: false,
  37. // An array of glob patterns indicating a set of files for which coverage information should be collected
  38. collectCoverageFrom: [
  39. 'src/client/**/*.js',
  40. 'src/lib/**/*.js',
  41. 'src/migrations/**/*.js',
  42. 'src/server/**/*.js',
  43. ],
  44. // The directory where Jest should output its coverage files
  45. coverageDirectory: 'coverage',
  46. };