jest.config.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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', '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. setupFiles: [
  22. '<rootDir>/src/sentry/static/sentry/app/utils/silence-react-unsafe-warnings.ts',
  23. '<rootDir>/tests/js/throw-on-react-error.js',
  24. '<rootDir>/tests/js/setup.js',
  25. 'jest-canvas-mock',
  26. ],
  27. setupFilesAfterEnv: ['<rootDir>/tests/js/setupFramework.ts'],
  28. testMatch: ['<rootDir>/tests/js/**/*(*.)@(spec|test).(js|ts)?(x)'],
  29. testPathIgnorePatterns: ['<rootDir>/tests/sentry/lang/javascript/'],
  30. unmockedModulePathPatterns: [
  31. '<rootDir>/node_modules/react',
  32. '<rootDir>/node_modules/reflux',
  33. ],
  34. transform: {
  35. '^.+\\.jsx?$': 'babel-jest',
  36. '^.+\\.tsx?$': 'babel-jest',
  37. },
  38. moduleFileExtensions: ['js', 'ts', 'jsx', 'tsx'],
  39. globals: {},
  40. reporters: [
  41. 'default',
  42. [
  43. 'jest-junit',
  44. {
  45. outputDirectory: '.artifacts',
  46. outputName: 'jest.junit.xml',
  47. },
  48. ],
  49. ],
  50. testRunner: 'jest-circus/runner',
  51. testEnvironment: '<rootDir>/tests/js/instrumentedEnv',
  52. testEnvironmentOptions: {
  53. output: path.resolve(__dirname, '.artifacts', 'visual-snapshots', 'jest'),
  54. SENTRY_DSN: 'https://3fe1dce93e3a4267979ebad67f3de327@sentry.io/4857230',
  55. },
  56. };