jest.config.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. module.exports = {
  2. preset: 'ts-jest/presets/js-with-babel',
  3. clearMocks: true,
  4. // The directory where Jest should output its coverage files
  5. coverageDirectory: 'coverage',
  6. // The test environment that will be used for testing
  7. testURL: 'http://localhost/',
  8. // Directory to search for tests
  9. roots: ['src/js/baglass/react/'],
  10. // The glob patterns Jest uses to detect test files
  11. testMatch: [
  12. '**/__tests__/**/*.test.[jt]s?(x)',
  13. ],
  14. // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
  15. testPathIgnorePatterns: [
  16. '/node_modules/'
  17. ],
  18. moduleNameMapper: {
  19. 'baglass/core-client/js/core-client/(.*)$': '<rootDir>/node_modules/@waca/core-client/js/core-client/$1',
  20. 'baglass/(.*)$': '<rootDir>/src/js/baglass/$1',
  21. 'mocks/(.*)$': '<rootDir>/src/js/baglass/react/testMocks/$1',
  22. 'ca-ui-toolkit-common': '@waca/ca-ui-toolkit/dist/js/uitoolkit/1.0/ca-ui-toolkit-common.js',
  23. 'ca-ui-toolkit-core': '@waca/ca-ui-toolkit/dist/js/uitoolkit/1.0/ca-ui-toolkit-core.js',
  24. '^polyglot': 'node-polyglot',
  25. '^webpackedGlass/(.*)$': '<rootDir>/src/js/baglass/react/$1',
  26. 'underscore': 'underscore/underscore.js'
  27. },
  28. setupFiles: [
  29. '<rootDir>/src/js/baglass/react/testMocks/ConfigureConsole.js'
  30. ],
  31. setupFilesAfterEnv: ['<rootDir>/src/js/baglass/react/testMocks/ModuleMocks.js'],
  32. snapshotSerializers: [
  33. 'enzyme-to-json/serializer'
  34. ]
  35. };