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 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2024 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. module.exports = {
  21. coverageDirectory: '<rootDir>/coverage',
  22. collectCoverageFrom: ['src/main/js/**/*.{ts,tsx,js}', '!helpers/{keycodes,testUtils}.{ts,tsx}'],
  23. coverageReporters: ['lcovonly', 'text'],
  24. moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
  25. moduleNameMapper: {
  26. '^.+\\.(md|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
  27. '<rootDir>/config/jest/FileStub.js',
  28. '^.+\\.css$': '<rootDir>/config/jest/CSSStub.js',
  29. },
  30. setupFiles: [
  31. '<rootDir>/config/polyfills.ts',
  32. '<rootDir>/config/jest/SetupTestEnvironment.ts',
  33. '<rootDir>/config/jest/SetupTheme.js',
  34. ],
  35. setupFilesAfterEnv: [
  36. '<rootDir>/config/jest/SetupReactTestingLibrary.ts',
  37. '<rootDir>/config/jest/SetupJestAxe.ts',
  38. '<rootDir>/config/jest/SetupFailOnConsole.ts',
  39. ],
  40. snapshotSerializers: ['@emotion/jest/serializer'],
  41. testEnvironment: 'jsdom',
  42. testPathIgnorePatterns: [
  43. '<rootDir>/config',
  44. '<rootDir>/design-system',
  45. '<rootDir>/node_modules',
  46. '<rootDir>/scripts',
  47. ],
  48. testRegex: '(/__tests__/.*|\\-test)\\.(ts|tsx|js)$',
  49. transform: {
  50. '^.+\\.(t|j)sx?$': [
  51. '@swc/jest',
  52. {
  53. jsc: {
  54. target: 'es2018',
  55. },
  56. },
  57. ],
  58. },
  59. transformIgnorePatterns: ['/node_modules/(?!(d3-.+))/'],
  60. reporters: [
  61. 'default',
  62. [
  63. 'jest-junit',
  64. {
  65. outputDirectory: 'build/test-results/test-jest',
  66. outputName: 'junit.xml',
  67. ancestorSeparator: ' > ',
  68. suiteNameTemplate: '{filename}',
  69. classNameTemplate: '{classname}',
  70. titleTemplate: '{title}',
  71. },
  72. ],
  73. [
  74. './config/jest/DataDogReporter.js',
  75. {
  76. outputFilepath: '/tmp/ut-ts-web-test-monitoring.log',
  77. },
  78. ],
  79. ['jest-slow-test-reporter', { numTests: 5, warnOnSlowerThan: 10000, color: true }],
  80. ],
  81. testTimeout: 60000,
  82. };