jest.config.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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: "/tmp/jest_rs",
  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 using an 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. // 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.
  46. // maxWorkers: "50%",
  47. // An array of directory names to be searched recursively up from the requiring module's location
  48. // moduleDirectories: [
  49. // "node_modules"
  50. // ],
  51. // An array of file extensions your modules use
  52. moduleFileExtensions: [
  53. "js",
  54. "json",
  55. // "jsx",
  56. // "ts",
  57. // "tsx",
  58. // "node",
  59. "svetle",
  60. ],
  61. // A map from regular expressions to module names that allow to stub out resources with a single module
  62. // moduleNameMapper: {},
  63. // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
  64. // modulePathIgnorePatterns: [],
  65. // Activates notifications for test results
  66. // notify: false,
  67. // An enum that specifies notification mode. Requires { notify: true }
  68. // notifyMode: "failure-change",
  69. // A preset that is used as a base for Jest's configuration
  70. // preset: null,
  71. // Run tests from one or more projects
  72. // projects: null,
  73. // Use this configuration option to add custom reporters to Jest
  74. // reporters: undefined,
  75. // Automatically reset mock state between every test
  76. // resetMocks: false,
  77. // Reset the module registry before running each individual test
  78. // resetModules: false,
  79. // A path to a custom resolver
  80. // resolver: null,
  81. // Automatically restore mock state between every test
  82. // restoreMocks: false,
  83. // The root directory that Jest should scan for tests and modules within
  84. // rootDir: null,
  85. // A list of paths to directories that Jest should use to search for files in
  86. // roots: [
  87. // "<rootDir>"
  88. // ],
  89. // Allows you to use a custom runner instead of Jest's default test runner
  90. // runner: "jest-runner",
  91. // The paths to modules that run some code to configure or set up the testing environment before each test
  92. // setupFiles: [],
  93. // A list of paths to modules that run some code to configure or set up the testing framework before each test
  94. setupFilesAfterEnv: [
  95. '@testing-library/svelte/cleanup-after-each',
  96. ],
  97. // A list of paths to snapshot serializer modules Jest should use for snapshot testing
  98. // snapshotSerializers: [],
  99. // The test environment that will be used for testing
  100. // testEnvironment: "jest-environment-jsdom",
  101. // Options that will be passed to the testEnvironment
  102. // testEnvironmentOptions: {},
  103. // Adds a location field to test results
  104. // testLocationInResults: false,
  105. // The glob patterns Jest uses to detect test files
  106. testMatch: [
  107. "**/tests/*.js",
  108. "**/__tests__/**/*.[jt]s?(x)",
  109. // "**/?(*.)+(spec|test).[tj]s?(x)"
  110. ],
  111. // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
  112. // testPathIgnorePatterns: [
  113. // "/node_modules/"
  114. // ],
  115. // The regexp pattern or array of patterns that Jest uses to detect test files
  116. // testRegex: [],
  117. // This option allows the use of a custom results processor
  118. // testResultsProcessor: null,
  119. // This option allows use of a custom test runner
  120. // testRunner: "jasmine2",
  121. // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
  122. // testURL: "http://localhost",
  123. // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
  124. // timers: "real",
  125. // A map from regular expressions to paths to transformers
  126. // transform: null,
  127. "transform": {
  128. "\\.js$": "babel-jest",
  129. "\\.svelte$": "svelte-jest"
  130. },
  131. // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
  132. // transformIgnorePatterns: [
  133. // "/node_modules/"
  134. // ],
  135. // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
  136. // unmockedModulePathPatterns: undefined,
  137. // Indicates whether each individual test should be reported during the run
  138. // verbose: null,
  139. // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
  140. // watchPathIgnorePatterns: [],
  141. // Whether to use watchman for file crawling
  142. // watchman: true,
  143. };