You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

jest.config.js 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. module.exports = {
  2. coverageDirectory: '<rootDir>/coverage',
  3. collectCoverageFrom: ['src/main/js/**/*.{ts,tsx,js}', '!helpers/{keycodes,testUtils}.{ts,tsx}'],
  4. coverageReporters: ['lcovonly', 'text'],
  5. globals: {
  6. 'ts-jest': {
  7. diagnostics: false,
  8. },
  9. },
  10. moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
  11. moduleNameMapper: {
  12. '^.+\\.(md|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
  13. '<rootDir>/config/jest/FileStub.js',
  14. '^.+\\.css$': '<rootDir>/config/jest/CSSStub.js',
  15. },
  16. setupFiles: [
  17. '<rootDir>/config/polyfills.ts',
  18. '<rootDir>/config/jest/SetupTestEnvironment.ts',
  19. '<rootDir>/config/jest/SetupTheme.js',
  20. ],
  21. setupFilesAfterEnv: [
  22. '<rootDir>/config/jest/SetupReactTestingLibrary.ts',
  23. '<rootDir>/config/jest/SetupJestAxe.ts',
  24. ],
  25. snapshotSerializers: ['@emotion/jest/serializer'],
  26. testEnvironment: 'jsdom',
  27. testPathIgnorePatterns: [
  28. '<rootDir>/config',
  29. '<rootDir>/design-system',
  30. '<rootDir>/node_modules',
  31. '<rootDir>/scripts',
  32. ],
  33. testRegex: '(/__tests__/.*|\\-test)\\.(ts|tsx|js)$',
  34. transform: {
  35. '^.+\\.(t|j)sx?$': [
  36. '@swc/jest',
  37. {
  38. jsc: {
  39. target: 'es2018',
  40. },
  41. },
  42. ],
  43. },
  44. transformIgnorePatterns: ['/node_modules/(?!(d3-.+))/'],
  45. reporters: [
  46. 'default',
  47. [
  48. 'jest-junit',
  49. {
  50. outputDirectory: 'build/test-results/test-jest',
  51. outputName: 'junit.xml',
  52. ancestorSeparator: ' > ',
  53. suiteNameTemplate: '{filename}',
  54. classNameTemplate: '{classname}',
  55. titleTemplate: '{title}',
  56. },
  57. ],
  58. [
  59. './config/jest/DataDogReporter.js',
  60. {
  61. outputFilepath: '/tmp/ut-ts-web-test-monitoring.log',
  62. },
  63. ],
  64. ['jest-slow-test-reporter', { numTests: 5, warnOnSlowerThan: 10000, color: true }],
  65. ],
  66. testTimeout: 60000,
  67. };