ValidConfig.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true
  4. });
  5. exports.initialProjectOptions = exports.initialOptions = void 0;
  6. function _jestRegexUtil() {
  7. const data = require('jest-regex-util');
  8. _jestRegexUtil = function () {
  9. return data;
  10. };
  11. return data;
  12. }
  13. function _jestValidate() {
  14. const data = require('jest-validate');
  15. _jestValidate = function () {
  16. return data;
  17. };
  18. return data;
  19. }
  20. function _prettyFormat() {
  21. const data = require('pretty-format');
  22. _prettyFormat = function () {
  23. return data;
  24. };
  25. return data;
  26. }
  27. var _constants = require('./constants');
  28. /**
  29. * Copyright (c) Meta Platforms, Inc. and affiliates.
  30. *
  31. * This source code is licensed under the MIT license found in the
  32. * LICENSE file in the root directory of this source tree.
  33. */
  34. const NODE_MODULES_REGEXP = (0, _jestRegexUtil().replacePathSepForRegex)(
  35. _constants.NODE_MODULES
  36. );
  37. const initialOptions = {
  38. automock: false,
  39. bail: (0, _jestValidate().multipleValidOptions)(false, 0),
  40. cache: true,
  41. cacheDirectory: '/tmp/user/jest',
  42. changedFilesWithAncestor: false,
  43. changedSince: 'master',
  44. ci: false,
  45. clearMocks: false,
  46. collectCoverage: true,
  47. collectCoverageFrom: ['src', '!public'],
  48. coverageDirectory: 'coverage',
  49. coveragePathIgnorePatterns: [NODE_MODULES_REGEXP],
  50. coverageProvider: 'v8',
  51. coverageReporters: ['json', 'text', 'lcov', 'clover'],
  52. coverageThreshold: {
  53. global: {
  54. branches: 50,
  55. functions: 100,
  56. lines: 100,
  57. statements: 100
  58. }
  59. },
  60. dependencyExtractor: '<rootDir>/dependencyExtractor.js',
  61. detectLeaks: false,
  62. detectOpenHandles: false,
  63. displayName: (0, _jestValidate().multipleValidOptions)('test-config', {
  64. color: 'blue',
  65. name: 'test-config'
  66. }),
  67. errorOnDeprecated: false,
  68. expand: false,
  69. extensionsToTreatAsEsm: [],
  70. fakeTimers: {
  71. advanceTimers: (0, _jestValidate().multipleValidOptions)(40, true),
  72. doNotFake: [
  73. 'Date',
  74. 'hrtime',
  75. 'nextTick',
  76. 'performance',
  77. 'queueMicrotask',
  78. 'requestAnimationFrame',
  79. 'cancelAnimationFrame',
  80. 'requestIdleCallback',
  81. 'cancelIdleCallback',
  82. 'setImmediate',
  83. 'clearImmediate',
  84. 'setInterval',
  85. 'clearInterval',
  86. 'setTimeout',
  87. 'clearTimeout'
  88. ],
  89. enableGlobally: true,
  90. legacyFakeTimers: false,
  91. now: 1483228800000,
  92. timerLimit: 1000
  93. },
  94. filter: '<rootDir>/filter.js',
  95. forceCoverageMatch: ['**/*.t.js'],
  96. forceExit: false,
  97. globalSetup: 'setup.js',
  98. globalTeardown: 'teardown.js',
  99. globals: {
  100. __DEV__: true
  101. },
  102. haste: {
  103. computeSha1: true,
  104. defaultPlatform: 'ios',
  105. enableSymlinks: false,
  106. forceNodeFilesystemAPI: true,
  107. hasteImplModulePath: '<rootDir>/haste_impl.js',
  108. hasteMapModulePath: '',
  109. platforms: ['ios', 'android'],
  110. retainAllFiles: false,
  111. throwOnModuleCollision: false
  112. },
  113. id: 'string',
  114. injectGlobals: true,
  115. json: false,
  116. lastCommit: false,
  117. listTests: false,
  118. logHeapUsage: true,
  119. maxConcurrency: 5,
  120. maxWorkers: '50%',
  121. moduleDirectories: ['node_modules'],
  122. moduleFileExtensions: [
  123. 'js',
  124. 'mjs',
  125. 'cjs',
  126. 'json',
  127. 'jsx',
  128. 'ts',
  129. 'tsx',
  130. 'node'
  131. ],
  132. moduleNameMapper: {
  133. '^React$': '<rootDir>/node_modules/react'
  134. },
  135. modulePathIgnorePatterns: ['<rootDir>/build/'],
  136. modulePaths: ['/shared/vendor/modules'],
  137. noStackTrace: false,
  138. notify: false,
  139. notifyMode: 'failure-change',
  140. onlyChanged: false,
  141. onlyFailures: false,
  142. openHandlesTimeout: 1000,
  143. passWithNoTests: false,
  144. preset: 'react-native',
  145. prettierPath: '<rootDir>/node_modules/prettier',
  146. projects: ['project-a', 'project-b/'],
  147. randomize: false,
  148. reporters: [
  149. 'default',
  150. 'custom-reporter-1',
  151. [
  152. 'custom-reporter-2',
  153. {
  154. configValue: true
  155. }
  156. ]
  157. ],
  158. resetMocks: false,
  159. resetModules: false,
  160. resolver: '<rootDir>/resolver.js',
  161. restoreMocks: false,
  162. rootDir: '/',
  163. roots: ['<rootDir>'],
  164. runTestsByPath: false,
  165. runner: 'jest-runner',
  166. runtime: '<rootDir>',
  167. sandboxInjectedGlobals: [],
  168. setupFiles: ['<rootDir>/setup.js'],
  169. setupFilesAfterEnv: ['<rootDir>/testSetupFile.js'],
  170. showSeed: false,
  171. silent: true,
  172. skipFilter: false,
  173. skipNodeResolution: false,
  174. slowTestThreshold: 5,
  175. snapshotFormat: _prettyFormat().DEFAULT_OPTIONS,
  176. snapshotResolver: '<rootDir>/snapshotResolver.js',
  177. snapshotSerializers: ['my-serializer-module'],
  178. testEnvironment: 'jest-environment-node',
  179. testEnvironmentOptions: {
  180. url: 'http://localhost',
  181. userAgent: 'Agent/007'
  182. },
  183. testFailureExitCode: 1,
  184. testLocationInResults: false,
  185. testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
  186. testNamePattern: 'test signature',
  187. testPathIgnorePatterns: [NODE_MODULES_REGEXP],
  188. testRegex: (0, _jestValidate().multipleValidOptions)(
  189. '(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$',
  190. ['/__tests__/\\.test\\.[jt]sx?$', '/__tests__/\\.spec\\.[jt]sx?$']
  191. ),
  192. testResultsProcessor: 'processor-node-module',
  193. testRunner: 'circus',
  194. testSequencer: '@jest/test-sequencer',
  195. testTimeout: 5000,
  196. transform: {
  197. '\\.js$': '<rootDir>/preprocessor.js'
  198. },
  199. transformIgnorePatterns: [NODE_MODULES_REGEXP],
  200. unmockedModulePathPatterns: ['mock'],
  201. updateSnapshot: true,
  202. useStderr: false,
  203. verbose: false,
  204. watch: false,
  205. watchAll: false,
  206. watchPathIgnorePatterns: ['<rootDir>/e2e/'],
  207. watchPlugins: [
  208. 'path/to/yourWatchPlugin',
  209. [
  210. 'jest-watch-typeahead/filename',
  211. {
  212. key: 'k',
  213. prompt: 'do something with my custom prompt'
  214. }
  215. ]
  216. ],
  217. watchman: true,
  218. workerIdleMemoryLimit: (0, _jestValidate().multipleValidOptions)(0.2, '50%'),
  219. workerThreads: true
  220. };
  221. exports.initialOptions = initialOptions;
  222. const initialProjectOptions = {
  223. automock: false,
  224. cache: true,
  225. cacheDirectory: '/tmp/user/jest',
  226. clearMocks: false,
  227. collectCoverageFrom: ['src', '!public'],
  228. coverageDirectory: 'coverage',
  229. coveragePathIgnorePatterns: [NODE_MODULES_REGEXP],
  230. dependencyExtractor: '<rootDir>/dependencyExtractor.js',
  231. detectLeaks: false,
  232. detectOpenHandles: false,
  233. displayName: (0, _jestValidate().multipleValidOptions)('test-config', {
  234. color: 'blue',
  235. name: 'test-config'
  236. }),
  237. errorOnDeprecated: false,
  238. extensionsToTreatAsEsm: [],
  239. fakeTimers: {
  240. advanceTimers: (0, _jestValidate().multipleValidOptions)(40, true),
  241. doNotFake: [
  242. 'Date',
  243. 'hrtime',
  244. 'nextTick',
  245. 'performance',
  246. 'queueMicrotask',
  247. 'requestAnimationFrame',
  248. 'cancelAnimationFrame',
  249. 'requestIdleCallback',
  250. 'cancelIdleCallback',
  251. 'setImmediate',
  252. 'clearImmediate',
  253. 'setInterval',
  254. 'clearInterval',
  255. 'setTimeout',
  256. 'clearTimeout'
  257. ],
  258. enableGlobally: true,
  259. legacyFakeTimers: false,
  260. now: 1483228800000,
  261. timerLimit: 1000
  262. },
  263. filter: '<rootDir>/filter.js',
  264. forceCoverageMatch: ['**/*.t.js'],
  265. globalSetup: 'setup.js',
  266. globalTeardown: 'teardown.js',
  267. globals: {
  268. __DEV__: true
  269. },
  270. haste: {
  271. computeSha1: true,
  272. defaultPlatform: 'ios',
  273. enableSymlinks: false,
  274. forceNodeFilesystemAPI: true,
  275. hasteImplModulePath: '<rootDir>/haste_impl.js',
  276. hasteMapModulePath: '',
  277. platforms: ['ios', 'android'],
  278. retainAllFiles: false,
  279. throwOnModuleCollision: false
  280. },
  281. id: 'string',
  282. injectGlobals: true,
  283. moduleDirectories: ['node_modules'],
  284. moduleFileExtensions: [
  285. 'js',
  286. 'mjs',
  287. 'cjs',
  288. 'json',
  289. 'jsx',
  290. 'ts',
  291. 'tsx',
  292. 'node'
  293. ],
  294. moduleNameMapper: {
  295. '^React$': '<rootDir>/node_modules/react'
  296. },
  297. modulePathIgnorePatterns: ['<rootDir>/build/'],
  298. modulePaths: ['/shared/vendor/modules'],
  299. openHandlesTimeout: 1000,
  300. preset: 'react-native',
  301. prettierPath: '<rootDir>/node_modules/prettier',
  302. resetMocks: false,
  303. resetModules: false,
  304. resolver: '<rootDir>/resolver.js',
  305. restoreMocks: false,
  306. rootDir: '/',
  307. roots: ['<rootDir>'],
  308. runner: 'jest-runner',
  309. runtime: '<rootDir>',
  310. sandboxInjectedGlobals: [],
  311. setupFiles: ['<rootDir>/setup.js'],
  312. setupFilesAfterEnv: ['<rootDir>/testSetupFile.js'],
  313. skipFilter: false,
  314. skipNodeResolution: false,
  315. slowTestThreshold: 5,
  316. snapshotFormat: _prettyFormat().DEFAULT_OPTIONS,
  317. snapshotResolver: '<rootDir>/snapshotResolver.js',
  318. snapshotSerializers: ['my-serializer-module'],
  319. testEnvironment: 'jest-environment-node',
  320. testEnvironmentOptions: {
  321. url: 'http://localhost',
  322. userAgent: 'Agent/007'
  323. },
  324. testLocationInResults: false,
  325. testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
  326. testPathIgnorePatterns: [NODE_MODULES_REGEXP],
  327. testRegex: (0, _jestValidate().multipleValidOptions)(
  328. '(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$',
  329. ['/__tests__/\\.test\\.[jt]sx?$', '/__tests__/\\.spec\\.[jt]sx?$']
  330. ),
  331. testRunner: 'circus',
  332. transform: {
  333. '\\.js$': '<rootDir>/preprocessor.js'
  334. },
  335. transformIgnorePatterns: [NODE_MODULES_REGEXP],
  336. unmockedModulePathPatterns: ['mock'],
  337. watchPathIgnorePatterns: ['<rootDir>/e2e/'],
  338. workerIdleMemoryLimit: (0, _jestValidate().multipleValidOptions)(0.2, '50%')
  339. };
  340. exports.initialProjectOptions = initialProjectOptions;