暫無描述

jest.config.js 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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. // Respect "browser" field in package.json when resolving modules
  9. // browser: false,
  10. // The directory where Jest should store its cached dependency information
  11. // cacheDirectory: "/private/var/folders/8f/kgcy219d1dvfvbcqky441_d00000gp/T/jest_dy",
  12. // Automatically clear mock calls and instances between every test
  13. clearMocks: true,
  14. // Indicates whether the coverage information should be collected while executing the test
  15. // collectCoverage: false,
  16. // An array of glob patterns indicating a set of files for which coverage information should be collected
  17. // collectCoverageFrom: null,
  18. // The directory where Jest should output its coverage files
  19. // coverageDirectory: "coverage",
  20. // An array of regexp pattern strings used to skip coverage collection
  21. // coveragePathIgnorePatterns: [
  22. // "/node_modules/"
  23. // ],
  24. // A list of reporter names that Jest uses when writing coverage reports
  25. // coverageReporters: [
  26. // "json",
  27. // "text",
  28. // "lcov",
  29. // "clover"
  30. // ],
  31. // An object that configures minimum threshold enforcement for coverage results
  32. // coverageThreshold: null,
  33. // A path to a custom dependency extractor
  34. // dependencyExtractor: null,
  35. // Make calling deprecated APIs throw helpful error messages
  36. // errorOnDeprecated: false,
  37. // Force coverage collection from ignored files usin a array of glob patterns
  38. // forceCoverageMatch: [],
  39. // A path to a module which exports an async function that is triggered once before all test suites
  40. // globalSetup: null,
  41. // A path to a module which exports an async function that is triggered once after all test suites
  42. // globalTeardown: null,
  43. // A set of global variables that need to be available in all test environments
  44. // globals: {},
  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 that allow to stub out resources with a single module
  59. // moduleNameMapper: {},
  60. // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
  61. // modulePathIgnorePatterns: [],
  62. // Activates notifications for test results
  63. // notify: false,
  64. // An enum that specifies notification mode. Requires { notify: true }
  65. // notifyMode: "failure-change",
  66. // A preset that is used as a base for Jest's configuration
  67. preset: "react-native",
  68. // Run tests from one or more projects
  69. // projects: null,
  70. // Use this configuration option to add custom reporters to Jest
  71. // reporters: undefined,
  72. // Automatically reset mock state between every test
  73. // resetMocks: false,
  74. // Reset the module registry before running each individual test
  75. // resetModules: false,
  76. // A path to a custom resolver
  77. // resolver: null,
  78. // Automatically restore mock state between every test
  79. // restoreMocks: false,
  80. // The root directory that Jest should scan for tests and modules within
  81. // rootDir: null,
  82. // A list of paths to directories that Jest should use to search for files in
  83. // roots: [
  84. // "<rootDir>"
  85. // ],
  86. // Allows you to use a custom runner instead of Jest's default test runner
  87. // runner: "jest-runner",
  88. // The paths to modules that run some code to configure or set up the testing environment before each test
  89. // setupFiles: [],
  90. // A list of paths to modules that run some code to configure or set up the testing framework before each test
  91. // setupFilesAfterEnv: [],
  92. // A list of paths to snapshot serializer modules Jest should use for snapshot testing
  93. // snapshotSerializers: [],
  94. // The test environment that will be used for testing
  95. testEnvironment: "node",
  96. // Options that will be passed to the testEnvironment
  97. // testEnvironmentOptions: {},
  98. // Adds a location field to test results
  99. // testLocationInResults: false,
  100. // The glob patterns Jest uses to detect test files
  101. // testMatch: [
  102. // "**/__tests__/**/*.[jt]s?(x)",
  103. // "**/?(*.)+(spec|test).[tj]s?(x)"
  104. // ],
  105. // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
  106. // testPathIgnorePatterns: [
  107. // "/node_modules/"
  108. // ],
  109. // The regexp pattern or array of patterns that Jest uses to detect test files
  110. // testRegex: [],
  111. // This option allows the use of a custom results processor
  112. // testResultsProcessor: null,
  113. // This option allows use of a custom test runner
  114. // testRunner: "jasmine2",
  115. // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
  116. // testURL: "http://localhost",
  117. // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
  118. // timers: "real",
  119. // A map from regular expressions to paths to transformers
  120. // transform: null,
  121. // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
  122. // transformIgnorePatterns: [
  123. // "/node_modules/"
  124. // ],
  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: null,
  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. };