jest.config.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. // For a detailed explanation regarding each configuration property, visit:
  2. // https://jestjs.io/docs/en/configuration.html
  3. module.exports = {
  4. // All imported modules in your tests should be mocked automatically
  5. // automock: false,
  6. // Stop running tests after `n` failures
  7. // bail: 0,
  8. // The directory where Jest should store its cached dependency information
  9. // cacheDirectory: "/private/var/folders/tx/47b7v82n6w3dqxgdzv3zhhf00000gn/T/jest_dx",
  10. // Automatically clear mock calls and instances between every test
  11. clearMocks: true,
  12. // Indicates whether the coverage information should be collected while executing the test
  13. // collectCoverage: false,
  14. // An array of glob patterns indicating a set of files for which coverage information should be collected
  15. // collectCoverageFrom: undefined,
  16. // The directory where Jest should output its coverage files
  17. coverageDirectory: '.coverage',
  18. // An array of regexp pattern strings used to skip coverage collection
  19. // coveragePathIgnorePatterns: [
  20. // "/node_modules/"
  21. // ],
  22. // A list of reporter names that Jest uses when writing coverage reports
  23. // coverageReporters: [
  24. // "json",
  25. // "text",
  26. // "lcov",
  27. // "clover"
  28. // ],
  29. // An object that configures minimum threshold enforcement for coverage results
  30. // coverageThreshold: undefined,
  31. // A path to a custom dependency extractor
  32. // dependencyExtractor: undefined,
  33. // Make calling deprecated APIs throw helpful error messages
  34. // errorOnDeprecated: false,
  35. // Force coverage collection from ignored files using an array of glob patterns
  36. // forceCoverageMatch: [],
  37. // A path to a module which exports an async function that is triggered once before all test suites
  38. // globalSetup: undefined,
  39. // A path to a module which exports an async function that is triggered once after all test suites
  40. // globalTeardown: undefined,
  41. // A set of global variables that need to be available in all test environments
  42. // globals: {},
  43. // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
  44. // maxWorkers: "50%",
  45. // An array of directory names to be searched recursively up from the requiring module's location
  46. // moduleDirectories: [
  47. // "node_modules"
  48. // ],
  49. // An array of file extensions your modules use
  50. // moduleFileExtensions: [
  51. // "js",
  52. // "json",
  53. // "jsx",
  54. // "ts",
  55. // "tsx",
  56. // "node"
  57. // ],
  58. // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
  59. moduleNameMapper: {
  60. '\\.svg': '<rootDir>/__mocks__/svgrMock.js',
  61. },
  62. // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
  63. // modulePathIgnorePatterns: [],
  64. // Activates notifications for test results
  65. // notify: false,
  66. // An enum that specifies notification mode. Requires { notify: true }
  67. // notifyMode: "failure-change",
  68. // A preset that is used as a base for Jest's configuration
  69. // preset: undefined,
  70. // Run tests from one or more projects
  71. // projects: undefined,
  72. // Use this configuration option to add custom reporters to Jest
  73. // reporters: undefined,
  74. // Automatically reset mock state between every test
  75. // resetMocks: false,
  76. // Reset the module registry before running each individual test
  77. // resetModules: false,
  78. // A path to a custom resolver
  79. // resolver: undefined,
  80. // Automatically restore mock state between every test
  81. // restoreMocks: false,
  82. // The root directory that Jest should scan for tests and modules within
  83. // rootDir: undefined,
  84. // A list of paths to directories that Jest should use to search for files in
  85. // roots: [
  86. // "<rootDir>"
  87. // ],
  88. // Allows you to use a custom runner instead of Jest's default test runner
  89. // runner: "jest-runner",
  90. // The paths to modules that run some code to configure or set up the testing environment before each test
  91. // setupFiles: [],
  92. // A list of paths to modules that run some code to configure or set up the testing framework before each test
  93. setupFilesAfterEnv: ['<rootDir>/setupTests.js'],
  94. // A list of paths to snapshot serializer modules Jest should use for snapshot testing
  95. // snapshotSerializers: [],
  96. // The test environment that will be used for testing
  97. // testEnvironment: "jest-environment-jsdom",
  98. // Options that will be passed to the testEnvironment
  99. // testEnvironmentOptions: {},
  100. // Adds a location field to test results
  101. // testLocationInResults: false,
  102. // The glob patterns Jest uses to detect test files
  103. // testMatch: [
  104. // "**/__tests__/**/*.[jt]s?(x)",
  105. // "**/?(*.)+(spec|test).[tj]s?(x)"
  106. // ],
  107. // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
  108. // testPathIgnorePatterns: [
  109. // "/node_modules/"
  110. // ],
  111. // The regexp pattern or array of patterns that Jest uses to detect test files
  112. // testRegex: [],
  113. // This option allows the use of a custom results processor
  114. // testResultsProcessor: undefined,
  115. // This option allows use of a custom test runner
  116. // testRunner: "jasmine2",
  117. // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
  118. // testURL: "http://localhost",
  119. // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
  120. // timers: "real",
  121. // A map from regular expressions to paths to transformers
  122. // transform: undefined,
  123. // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
  124. transformIgnorePatterns: ['/node_modules/(?!@babel/runtime)'],
  125. // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
  126. // unmockedModulePathPatterns: undefined,
  127. // Indicates whether each individual test should be reported during the run
  128. // verbose: undefined,
  129. // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
  130. // watchPathIgnorePatterns: [],
  131. // Whether to use watchman for file crawling
  132. // watchman: true,
  133. }