index.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. /*!
  2. * /**
  3. * * Copyright (c) Meta Platforms, Inc. and affiliates.
  4. * *
  5. * * This source code is licensed under the MIT license found in the
  6. * * LICENSE file in the root directory of this source tree.
  7. * * /
  8. */
  9. /******/ (() => { // webpackBootstrap
  10. /******/ "use strict";
  11. /******/ var __webpack_modules__ = ({
  12. /***/ "./src/raw-types.ts":
  13. /***/ ((__unused_webpack_module, exports) => {
  14. Object.defineProperty(exports, "__esModule", ({
  15. value: true
  16. }));
  17. exports.SnapshotFormat = exports.InitialOptions = exports.FakeTimers = exports.CoverageReporterNames = exports.ChalkForegroundColors = void 0;
  18. function _typebox() {
  19. const data = require("@sinclair/typebox");
  20. _typebox = function () {
  21. return data;
  22. };
  23. return data;
  24. }
  25. /**
  26. * Copyright (c) Meta Platforms, Inc. and affiliates.
  27. *
  28. * This source code is licensed under the MIT license found in the
  29. * LICENSE file in the root directory of this source tree.
  30. */
  31. /* eslint-disable sort-keys */
  32. const SnapshotFormat = exports.SnapshotFormat = _typebox().Type.Partial(_typebox().Type.Object({
  33. callToJSON: _typebox().Type.Boolean(),
  34. compareKeys: _typebox().Type.Null(),
  35. escapeRegex: _typebox().Type.Boolean(),
  36. escapeString: _typebox().Type.Boolean(),
  37. highlight: _typebox().Type.Boolean(),
  38. indent: _typebox().Type.Integer({
  39. minimum: 0
  40. }),
  41. maxDepth: _typebox().Type.Integer({
  42. minimum: 0
  43. }),
  44. maxWidth: _typebox().Type.Integer({
  45. minimum: 0
  46. }),
  47. min: _typebox().Type.Boolean(),
  48. printBasicPrototype: _typebox().Type.Boolean(),
  49. printFunctionName: _typebox().Type.Boolean(),
  50. theme: _typebox().Type.Partial(_typebox().Type.Object({
  51. comment: _typebox().Type.String(),
  52. content: _typebox().Type.String(),
  53. prop: _typebox().Type.String(),
  54. tag: _typebox().Type.String(),
  55. value: _typebox().Type.String()
  56. }))
  57. }));
  58. const CoverageProvider = _typebox().Type.Union([_typebox().Type.Literal('babel'), _typebox().Type.Literal('v8')]);
  59. const CoverageThresholdValue = _typebox().Type.Partial(_typebox().Type.Object({
  60. branches: _typebox().Type.Number({
  61. minimum: 0,
  62. maximum: 100
  63. }),
  64. functions: _typebox().Type.Number({
  65. minimum: 0,
  66. maximum: 100
  67. }),
  68. lines: _typebox().Type.Number({
  69. minimum: 0,
  70. maximum: 100
  71. }),
  72. statements: _typebox().Type.Number({
  73. minimum: 0,
  74. maximum: 100
  75. })
  76. }));
  77. const CoverageThresholdBase = _typebox().Type.Object({
  78. global: CoverageThresholdValue
  79. }, {
  80. additionalProperties: CoverageThresholdValue
  81. });
  82. const CoverageThreshold = _typebox().Type.Unsafe(CoverageThresholdBase);
  83. // TODO: add type test that these are all the colors available in chalk.ForegroundColor
  84. const ChalkForegroundColors = exports.ChalkForegroundColors = _typebox().Type.Union([_typebox().Type.Literal('black'), _typebox().Type.Literal('red'), _typebox().Type.Literal('green'), _typebox().Type.Literal('yellow'), _typebox().Type.Literal('blue'), _typebox().Type.Literal('magenta'), _typebox().Type.Literal('cyan'), _typebox().Type.Literal('white'), _typebox().Type.Literal('gray'), _typebox().Type.Literal('grey'), _typebox().Type.Literal('blackBright'), _typebox().Type.Literal('redBright'), _typebox().Type.Literal('greenBright'), _typebox().Type.Literal('yellowBright'), _typebox().Type.Literal('blueBright'), _typebox().Type.Literal('magentaBright'), _typebox().Type.Literal('cyanBright'), _typebox().Type.Literal('whiteBright')]);
  85. const DisplayName = _typebox().Type.Object({
  86. name: _typebox().Type.String(),
  87. color: ChalkForegroundColors
  88. });
  89. // TODO: verify these are the names of istanbulReport.ReportOptions
  90. const CoverageReporterNames = exports.CoverageReporterNames = _typebox().Type.Union([_typebox().Type.Literal('clover'), _typebox().Type.Literal('cobertura'), _typebox().Type.Literal('html-spa'), _typebox().Type.Literal('html'), _typebox().Type.Literal('json'), _typebox().Type.Literal('json-summary'), _typebox().Type.Literal('lcov'), _typebox().Type.Literal('lcovonly'), _typebox().Type.Literal('none'), _typebox().Type.Literal('teamcity'), _typebox().Type.Literal('text'), _typebox().Type.Literal('text-lcov'), _typebox().Type.Literal('text-summary')]);
  91. const CoverageReporters = _typebox().Type.Array(_typebox().Type.Union([CoverageReporterNames, _typebox().Type.Tuple([CoverageReporterNames, _typebox().Type.Record(_typebox().Type.String(), _typebox().Type.Unknown())])]));
  92. const GlobalFakeTimersConfig = _typebox().Type.Partial(_typebox().Type.Object({
  93. enableGlobally: _typebox().Type.Boolean({
  94. description: 'Whether fake timers should be enabled globally for all test files.',
  95. default: false
  96. })
  97. }));
  98. const FakeableAPI = _typebox().Type.Union([_typebox().Type.Literal('Date'), _typebox().Type.Literal('hrtime'), _typebox().Type.Literal('nextTick'), _typebox().Type.Literal('performance'), _typebox().Type.Literal('queueMicrotask'), _typebox().Type.Literal('requestAnimationFrame'), _typebox().Type.Literal('cancelAnimationFrame'), _typebox().Type.Literal('requestIdleCallback'), _typebox().Type.Literal('cancelIdleCallback'), _typebox().Type.Literal('setImmediate'), _typebox().Type.Literal('clearImmediate'), _typebox().Type.Literal('setInterval'), _typebox().Type.Literal('clearInterval'), _typebox().Type.Literal('setTimeout'), _typebox().Type.Literal('clearTimeout')]);
  99. const FakeTimersConfig = _typebox().Type.Partial(_typebox().Type.Object({
  100. advanceTimers: _typebox().Type.Union([_typebox().Type.Boolean(), _typebox().Type.Number({
  101. minimum: 0
  102. })], {
  103. description: 'If set to `true` all timers will be advanced automatically by 20 milliseconds every 20 milliseconds. A custom ' + 'time delta may be provided by passing a number.',
  104. default: false
  105. }),
  106. doNotFake: _typebox().Type.Array(FakeableAPI, {
  107. description: 'List of names of APIs (e.g. `Date`, `nextTick()`, `setImmediate()`, `setTimeout()`) that should not be faked.' + '\n\nThe default is `[]`, meaning all APIs are faked.',
  108. default: []
  109. }),
  110. now: _typebox().Type.Integer({
  111. minimum: 0,
  112. description: 'Sets current system time to be used by fake timers.\n\nThe default is `Date.now()`.'
  113. }),
  114. timerLimit: _typebox().Type.Number({
  115. description: 'The maximum number of recursive timers that will be run when calling `jest.runAllTimers()`.',
  116. default: 100_000,
  117. minimum: 0
  118. }),
  119. legacyFakeTimers: _typebox().Type.Literal(false, {
  120. description: 'Use the old fake timers implementation instead of one backed by `@sinonjs/fake-timers`.',
  121. default: false
  122. })
  123. }));
  124. const LegacyFakeTimersConfig = _typebox().Type.Partial(_typebox().Type.Object({
  125. legacyFakeTimers: _typebox().Type.Literal(true, {
  126. description: 'Use the old fake timers implementation instead of one backed by `@sinonjs/fake-timers`.',
  127. default: true
  128. })
  129. }));
  130. const FakeTimers = exports.FakeTimers = _typebox().Type.Intersect([GlobalFakeTimersConfig, _typebox().Type.Union([FakeTimersConfig, LegacyFakeTimersConfig])]);
  131. const HasteConfig = _typebox().Type.Partial(_typebox().Type.Object({
  132. computeSha1: _typebox().Type.Boolean({
  133. description: 'Whether to hash files using SHA-1.'
  134. }),
  135. defaultPlatform: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Null()], {
  136. description: 'The platform to use as the default, e.g. `ios`.'
  137. }),
  138. forceNodeFilesystemAPI: _typebox().Type.Boolean({
  139. description: "Whether to force the use of Node's `fs` API when reading files rather than shelling out to `find`."
  140. }),
  141. enableSymlinks: _typebox().Type.Boolean({
  142. description: 'Whether to follow symlinks when crawling for files.' + '\n\tThis options cannot be used in projects which use watchman.' + '\n\tProjects with `watchman` set to true will error if this option is set to true.'
  143. }),
  144. hasteImplModulePath: _typebox().Type.String({
  145. description: 'Path to a custom implementation of Haste.'
  146. }),
  147. platforms: _typebox().Type.Array(_typebox().Type.String(), {
  148. description: "All platforms to target, e.g ['ios', 'android']."
  149. }),
  150. throwOnModuleCollision: _typebox().Type.Boolean({
  151. description: 'Whether to throw an error on module collision.'
  152. }),
  153. hasteMapModulePath: _typebox().Type.String({
  154. description: 'Custom HasteMap module'
  155. }),
  156. retainAllFiles: _typebox().Type.Boolean({
  157. description: 'Whether to retain all files, allowing e.g. search for tests in `node_modules`.'
  158. })
  159. }));
  160. const InitialOptions = exports.InitialOptions = _typebox().Type.Partial(_typebox().Type.Object({
  161. automock: _typebox().Type.Boolean(),
  162. bail: _typebox().Type.Union([_typebox().Type.Boolean(), _typebox().Type.Number()]),
  163. cache: _typebox().Type.Boolean(),
  164. cacheDirectory: _typebox().Type.String(),
  165. ci: _typebox().Type.Boolean(),
  166. clearMocks: _typebox().Type.Boolean(),
  167. changedFilesWithAncestor: _typebox().Type.Boolean(),
  168. changedSince: _typebox().Type.String(),
  169. collectCoverage: _typebox().Type.Boolean(),
  170. collectCoverageFrom: _typebox().Type.Array(_typebox().Type.String()),
  171. coverageDirectory: _typebox().Type.String(),
  172. coveragePathIgnorePatterns: _typebox().Type.Array(_typebox().Type.String()),
  173. coverageProvider: CoverageProvider,
  174. coverageReporters: CoverageReporters,
  175. coverageThreshold: CoverageThreshold,
  176. dependencyExtractor: _typebox().Type.String(),
  177. detectLeaks: _typebox().Type.Boolean(),
  178. detectOpenHandles: _typebox().Type.Boolean(),
  179. displayName: _typebox().Type.Union([_typebox().Type.String(), DisplayName]),
  180. expand: _typebox().Type.Boolean(),
  181. extensionsToTreatAsEsm: _typebox().Type.Array(_typebox().Type.String()),
  182. fakeTimers: FakeTimers,
  183. filter: _typebox().Type.String(),
  184. findRelatedTests: _typebox().Type.Boolean(),
  185. forceCoverageMatch: _typebox().Type.Array(_typebox().Type.String()),
  186. forceExit: _typebox().Type.Boolean(),
  187. json: _typebox().Type.Boolean(),
  188. globals: _typebox().Type.Record(_typebox().Type.String(), _typebox().Type.Unknown()),
  189. globalSetup: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Null()]),
  190. globalTeardown: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Null()]),
  191. haste: HasteConfig,
  192. id: _typebox().Type.String(),
  193. injectGlobals: _typebox().Type.Boolean(),
  194. reporters: _typebox().Type.Array(_typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Tuple([_typebox().Type.String(), _typebox().Type.Record(_typebox().Type.String(), _typebox().Type.Unknown())])])),
  195. logHeapUsage: _typebox().Type.Boolean(),
  196. lastCommit: _typebox().Type.Boolean(),
  197. listTests: _typebox().Type.Boolean(),
  198. maxConcurrency: _typebox().Type.Integer(),
  199. maxWorkers: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Integer()]),
  200. moduleDirectories: _typebox().Type.Array(_typebox().Type.String()),
  201. moduleFileExtensions: _typebox().Type.Array(_typebox().Type.String()),
  202. moduleNameMapper: _typebox().Type.Record(_typebox().Type.String(), _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Array(_typebox().Type.String())])),
  203. modulePathIgnorePatterns: _typebox().Type.Array(_typebox().Type.String()),
  204. modulePaths: _typebox().Type.Array(_typebox().Type.String()),
  205. noStackTrace: _typebox().Type.Boolean(),
  206. notify: _typebox().Type.Boolean(),
  207. notifyMode: _typebox().Type.String(),
  208. onlyChanged: _typebox().Type.Boolean(),
  209. onlyFailures: _typebox().Type.Boolean(),
  210. openHandlesTimeout: _typebox().Type.Number(),
  211. outputFile: _typebox().Type.String(),
  212. passWithNoTests: _typebox().Type.Boolean(),
  213. preset: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Null()]),
  214. prettierPath: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Null()]),
  215. projects: _typebox().Type.Array(_typebox().Type.Union([_typebox().Type.String(),
  216. // TODO: Make sure to type these correctly
  217. _typebox().Type.Record(_typebox().Type.String(), _typebox().Type.Unknown())])),
  218. randomize: _typebox().Type.Boolean(),
  219. replname: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Null()]),
  220. resetMocks: _typebox().Type.Boolean(),
  221. resetModules: _typebox().Type.Boolean(),
  222. resolver: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Null()]),
  223. restoreMocks: _typebox().Type.Boolean(),
  224. rootDir: _typebox().Type.String(),
  225. roots: _typebox().Type.Array(_typebox().Type.String()),
  226. runner: _typebox().Type.String(),
  227. runTestsByPath: _typebox().Type.Boolean(),
  228. runtime: _typebox().Type.String(),
  229. sandboxInjectedGlobals: _typebox().Type.Array(_typebox().Type.String()),
  230. setupFiles: _typebox().Type.Array(_typebox().Type.String()),
  231. setupFilesAfterEnv: _typebox().Type.Array(_typebox().Type.String()),
  232. showSeed: _typebox().Type.Boolean(),
  233. silent: _typebox().Type.Boolean(),
  234. skipFilter: _typebox().Type.Boolean(),
  235. skipNodeResolution: _typebox().Type.Boolean(),
  236. slowTestThreshold: _typebox().Type.Number(),
  237. snapshotResolver: _typebox().Type.String(),
  238. snapshotSerializers: _typebox().Type.Array(_typebox().Type.String()),
  239. snapshotFormat: SnapshotFormat,
  240. errorOnDeprecated: _typebox().Type.Boolean(),
  241. testEnvironment: _typebox().Type.String(),
  242. testEnvironmentOptions: _typebox().Type.Record(_typebox().Type.String(), _typebox().Type.Unknown()),
  243. testFailureExitCode: _typebox().Type.Integer(),
  244. testLocationInResults: _typebox().Type.Boolean(),
  245. testMatch: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Array(_typebox().Type.String())]),
  246. testNamePattern: _typebox().Type.String(),
  247. testPathIgnorePatterns: _typebox().Type.Array(_typebox().Type.String()),
  248. testRegex: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Array(_typebox().Type.String())]),
  249. testResultsProcessor: _typebox().Type.String(),
  250. testRunner: _typebox().Type.String(),
  251. testSequencer: _typebox().Type.String(),
  252. testTimeout: _typebox().Type.Number(),
  253. transform: _typebox().Type.Record(_typebox().Type.String(), _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Tuple([_typebox().Type.String(), _typebox().Type.Unknown()])])),
  254. transformIgnorePatterns: _typebox().Type.Array(_typebox().Type.String()),
  255. watchPathIgnorePatterns: _typebox().Type.Array(_typebox().Type.String()),
  256. unmockedModulePathPatterns: _typebox().Type.Array(_typebox().Type.String()),
  257. updateSnapshot: _typebox().Type.Boolean(),
  258. useStderr: _typebox().Type.Boolean(),
  259. verbose: _typebox().Type.Boolean(),
  260. waitForUnhandledRejections: _typebox().Type.Boolean(),
  261. watch: _typebox().Type.Boolean(),
  262. watchAll: _typebox().Type.Boolean(),
  263. watchman: _typebox().Type.Boolean(),
  264. watchPlugins: _typebox().Type.Array(_typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Tuple([_typebox().Type.String(), _typebox().Type.Unknown()])])),
  265. workerIdleMemoryLimit: _typebox().Type.Union([_typebox().Type.Number(), _typebox().Type.String()]),
  266. workerThreads: _typebox().Type.Boolean()
  267. }));
  268. /***/ })
  269. /******/ });
  270. /************************************************************************/
  271. /******/ // The module cache
  272. /******/ var __webpack_module_cache__ = {};
  273. /******/
  274. /******/ // The require function
  275. /******/ function __webpack_require__(moduleId) {
  276. /******/ // Check if module is in cache
  277. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  278. /******/ if (cachedModule !== undefined) {
  279. /******/ return cachedModule.exports;
  280. /******/ }
  281. /******/ // Create a new module (and put it into the cache)
  282. /******/ var module = __webpack_module_cache__[moduleId] = {
  283. /******/ // no module.id needed
  284. /******/ // no module.loaded needed
  285. /******/ exports: {}
  286. /******/ };
  287. /******/
  288. /******/ // Execute the module function
  289. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  290. /******/
  291. /******/ // Return the exports of the module
  292. /******/ return module.exports;
  293. /******/ }
  294. /******/
  295. /************************************************************************/
  296. var __webpack_exports__ = {};
  297. // This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
  298. (() => {
  299. var exports = __webpack_exports__;
  300. Object.defineProperty(exports, "__esModule", ({
  301. value: true
  302. }));
  303. exports.SnapshotFormat = exports.InitialOptions = exports.FakeTimers = void 0;
  304. var types = _interopRequireWildcard(__webpack_require__("./src/raw-types.ts"));
  305. function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
  306. /**
  307. * Copyright (c) Meta Platforms, Inc. and affiliates.
  308. *
  309. * This source code is licensed under the MIT license found in the
  310. * LICENSE file in the root directory of this source tree.
  311. */
  312. const SnapshotFormat = exports.SnapshotFormat = types.SnapshotFormat;
  313. const InitialOptions = exports.InitialOptions = types.InitialOptions;
  314. const FakeTimers = exports.FakeTimers = types.FakeTimers;
  315. })();
  316. module.exports = __webpack_exports__;
  317. /******/ })()
  318. ;