jest.config.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*eslint-env node*/
  2. const path = require('path'); // eslint-disable-line
  3. module.exports = {
  4. verbose: false,
  5. collectCoverageFrom: [
  6. 'tests/js/spec/**/*.{js,jsx,tsx}',
  7. 'src/sentry/static/sentry/app/**/*.{js,jsx,ts,tsx}',
  8. ],
  9. coverageReporters: ['html', 'lcov', 'cobertura'],
  10. coverageDirectory: '.artifacts/coverage/',
  11. snapshotSerializers: ['enzyme-to-json/serializer'],
  12. moduleNameMapper: {
  13. '^sentry-test/(.*)': '<rootDir>/tests/js/sentry-test/$1',
  14. '\\.(css|less|png|jpg|mp4)$': '<rootDir>/tests/js/sentry-test/importStyleMock.js',
  15. '\\.(svg)$': '<rootDir>/tests/js/sentry-test/svgMock.js',
  16. 'integration-docs-platforms':
  17. '<rootDir>/tests/fixtures/integration-docs/_platforms.json',
  18. },
  19. modulePaths: ['<rootDir>/src/sentry/static/sentry'],
  20. modulePathIgnorePatterns: ['<rootDir>/src/sentry/static/sentry/dist'],
  21. preset: '@visual-snapshot/jest',
  22. setupFiles: [
  23. '<rootDir>/src/sentry/static/sentry/app/utils/silence-react-unsafe-warnings.js',
  24. '<rootDir>/tests/js/throw-on-react-error.js',
  25. '<rootDir>/tests/js/setup.js',
  26. 'jest-canvas-mock',
  27. ],
  28. setupFilesAfterEnv: ['<rootDir>/tests/js/setupFramework.ts'],
  29. testMatch: ['<rootDir>/tests/js/**/*(*.)@(spec|test).(js|ts)?(x)'],
  30. testPathIgnorePatterns: ['<rootDir>/tests/sentry/lang/javascript/'],
  31. unmockedModulePathPatterns: [
  32. '<rootDir>/node_modules/react',
  33. '<rootDir>/node_modules/reflux',
  34. ],
  35. transform: {
  36. '^.+\\.jsx?$': 'babel-jest',
  37. '^.+\\.tsx?$': 'babel-jest',
  38. },
  39. moduleFileExtensions: ['js', 'ts', 'jsx', 'tsx'],
  40. globals: {},
  41. reporters: [
  42. 'default',
  43. [
  44. 'jest-junit',
  45. {
  46. outputDirectory: '.artifacts',
  47. outputName: 'jest.junit.xml',
  48. },
  49. ],
  50. ],
  51. testEnvironmentOptions: {
  52. output: path.resolve(__dirname, '.artifacts', 'visual-snapshots', 'jest'),
  53. },
  54. };