5
5
* LICENSE file in the root directory of this source tree.
6
6
*/
7
7
8
- import isCI = require( 'is-ci' ) ;
9
8
import type { Config } from '@jest/types' ;
10
9
import { constants , isJSONString } from 'jest-config' ;
11
10
@@ -89,37 +88,33 @@ export const usage =
89
88
'Usage: $0 [--config=<pathToConfigFile>] [TestPathPattern]' ;
90
89
export const docs = 'Documentation: https://jestjs.io/' ;
91
90
91
+ // The default values are all set in jest-config
92
92
export const options = {
93
93
all : {
94
- default : undefined ,
95
94
description :
96
95
'The opposite of `onlyChanged`. If `onlyChanged` is set by ' +
97
96
'default, running jest with `--all` will force Jest to run all tests ' +
98
97
'instead of running only tests related to changed files.' ,
99
98
type : 'boolean' ,
100
99
} ,
101
100
automock : {
102
- default : undefined ,
103
101
description : 'Automock all files by default.' ,
104
102
type : 'boolean' ,
105
103
} ,
106
104
bail : {
107
105
alias : 'b' ,
108
- default : undefined ,
109
106
description :
110
107
'Exit the test suite immediately after `n` number of failing tests.' ,
111
108
type : 'boolean' ,
112
109
} ,
113
110
browser : {
114
- default : undefined ,
115
111
description :
116
112
'Respect the "browser" field in package.json ' +
117
113
'when resolving modules. Some packages export different versions ' +
118
114
'based on whether they are operating in node.js or a browser.' ,
119
115
type : 'boolean' ,
120
116
} ,
121
117
cache : {
122
- default : undefined ,
123
118
description :
124
119
'Whether to use the transform cache. Disable the cache ' +
125
120
'using --no-cache.' ,
@@ -132,7 +127,6 @@ export const options = {
132
127
type : 'string' ,
133
128
} ,
134
129
changedFilesWithAncestor : {
135
- default : undefined ,
136
130
description :
137
131
'Runs tests related to the current changes and the changes made in the ' +
138
132
'last commit. Behaves similarly to `--onlyChanged`.' ,
@@ -147,29 +141,25 @@ export const options = {
147
141
type : 'string' ,
148
142
} ,
149
143
ci : {
150
- default : isCI ,
151
144
description :
152
145
'Whether to run Jest in continuous integration (CI) mode. ' +
153
146
'This option is on by default in most popular CI environments. It will ' +
154
147
'prevent snapshots from being written unless explicitly requested.' ,
155
148
type : 'boolean' ,
156
149
} ,
157
150
clearCache : {
158
- default : undefined ,
159
151
description :
160
152
'Clears the configured Jest cache directory and then exits. ' +
161
153
'Default directory can be found by calling jest --showConfig' ,
162
154
type : 'boolean' ,
163
155
} ,
164
156
clearMocks : {
165
- default : undefined ,
166
157
description :
167
158
'Automatically clear mock calls and instances between every ' +
168
159
'test. Equivalent to calling jest.clearAllMocks() between each test.' ,
169
160
type : 'boolean' ,
170
161
} ,
171
162
collectCoverage : {
172
- default : undefined ,
173
163
description : 'Alias for --coverage.' ,
174
164
type : 'boolean' ,
175
165
} ,
@@ -185,14 +175,12 @@ export const options = {
185
175
type : 'array' ,
186
176
} ,
187
177
color : {
188
- default : undefined ,
189
178
description :
190
179
'Forces test results output color highlighting (even if ' +
191
180
'stdout is not a TTY). Set to false if you would like to have no colors.' ,
192
181
type : 'boolean' ,
193
182
} ,
194
183
colors : {
195
- default : undefined ,
196
184
description : 'Alias for `--color`.' ,
197
185
type : 'boolean' ,
198
186
} ,
@@ -206,7 +194,6 @@ export const options = {
206
194
type : 'string' ,
207
195
} ,
208
196
coverage : {
209
- default : undefined ,
210
197
description :
211
198
'Indicates that test coverage information should be ' +
212
199
'collected and reported in the output.' ,
@@ -242,20 +229,17 @@ export const options = {
242
229
type : 'string' ,
243
230
} ,
244
231
debug : {
245
- default : undefined ,
246
232
description : 'Print debugging info about your jest config.' ,
247
233
type : 'boolean' ,
248
234
} ,
249
235
detectLeaks : {
250
- default : false ,
251
236
description :
252
237
'**EXPERIMENTAL**: Detect memory leaks in tests. After executing a ' +
253
238
'test, it will try to garbage collect the global object used, and fail ' +
254
239
'if it was leaked' ,
255
240
type : 'boolean' ,
256
241
} ,
257
242
detectOpenHandles : {
258
- default : false ,
259
243
description :
260
244
'Print out remaining open handles preventing Jest from exiting at the ' +
261
245
'end of a test run. Implies `runInBand`.' ,
@@ -269,18 +253,15 @@ export const options = {
269
253
type : 'string' ,
270
254
} ,
271
255
errorOnDeprecated : {
272
- default : false ,
273
256
description : 'Make calling deprecated APIs throw helpful error messages.' ,
274
257
type : 'boolean' ,
275
258
} ,
276
259
expand : {
277
260
alias : 'e' ,
278
- default : undefined ,
279
261
description : 'Use this flag to show full diffs instead of a patch.' ,
280
262
type : 'boolean' ,
281
263
} ,
282
264
filter : {
283
- default : undefined ,
284
265
description :
285
266
'Path to a module exporting a filtering function. This method receives ' +
286
267
'a list of tests which can be manipulated to exclude tests from ' +
@@ -289,15 +270,13 @@ export const options = {
289
270
type : 'string' ,
290
271
} ,
291
272
findRelatedTests : {
292
- default : undefined ,
293
273
description :
294
274
'Find related tests for a list of source files that were ' +
295
275
'passed in as arguments. Useful for pre-commit hook integration to run ' +
296
276
'the minimal amount of tests necessary.' ,
297
277
type : 'boolean' ,
298
278
} ,
299
279
forceExit : {
300
- default : undefined ,
301
280
description :
302
281
'Force Jest to exit after all tests have completed running. ' +
303
282
'This is useful when resources set up by test code cannot be ' +
@@ -332,44 +311,38 @@ export const options = {
332
311
type : 'boolean' ,
333
312
} ,
334
313
json : {
335
- default : undefined ,
336
314
description :
337
315
'Prints the test results in JSON. This mode will send all ' +
338
316
'other test output and user messages to stderr.' ,
339
317
type : 'boolean' ,
340
318
} ,
341
319
lastCommit : {
342
- default : undefined ,
343
320
description :
344
321
'Run all tests affected by file changes in the last commit made. ' +
345
322
'Behaves similarly to `--onlyChanged`.' ,
346
323
type : 'boolean' ,
347
324
} ,
348
325
listTests : {
349
- default : false ,
350
326
description :
351
327
'Lists all tests Jest will run given the arguments and ' +
352
328
'exits. Most useful in a CI system together with `--findRelatedTests` ' +
353
329
'to determine the tests Jest will run based on specific files' ,
354
330
type : 'boolean' ,
355
331
} ,
356
332
logHeapUsage : {
357
- default : undefined ,
358
333
description :
359
334
'Logs the heap usage after every test. Useful to debug ' +
360
335
'memory leaks. Use together with `--runInBand` and `--expose-gc` in ' +
361
336
'node.' ,
362
337
type : 'boolean' ,
363
338
} ,
364
339
mapCoverage : {
365
- default : undefined ,
366
340
description :
367
341
'Maps code coverage reports against original source code ' +
368
342
'when transformers supply source maps.\n\nDEPRECATED' ,
369
343
type : 'boolean' ,
370
344
} ,
371
345
maxConcurrency : {
372
- default : 5 ,
373
346
description :
374
347
'Specifies the maximum number of tests that are allowed to run' +
375
348
'concurrently. This only affects tests using `test.concurrent`.' ,
@@ -423,23 +396,19 @@ export const options = {
423
396
type : 'array' ,
424
397
} ,
425
398
noStackTrace : {
426
- default : undefined ,
427
399
description : 'Disables stack trace in test results output' ,
428
400
type : 'boolean' ,
429
401
} ,
430
402
notify : {
431
- default : undefined ,
432
403
description : 'Activates notifications for test results.' ,
433
404
type : 'boolean' ,
434
405
} ,
435
406
notifyMode : {
436
- default : 'failure-change' ,
437
407
description : 'Specifies when notifications will appear for test results.' ,
438
408
type : 'string' ,
439
409
} ,
440
410
onlyChanged : {
441
411
alias : 'o' ,
442
- default : undefined ,
443
412
description :
444
413
'Attempts to identify which tests to run based on which ' +
445
414
"files have changed in the current repository. Only works if you're " +
@@ -448,7 +417,6 @@ export const options = {
448
417
} ,
449
418
onlyFailures : {
450
419
alias : 'f' ,
451
- default : undefined ,
452
420
description : 'Run tests that failed in the previous execution.' ,
453
421
type : 'boolean' ,
454
422
} ,
@@ -459,7 +427,6 @@ export const options = {
459
427
type : 'string' ,
460
428
} ,
461
429
passWithNoTests : {
462
- default : false ,
463
430
description :
464
431
'Will not fail if no tests are found (for example while using `--testPathPattern`.)' ,
465
432
type : 'boolean' ,
@@ -469,7 +436,6 @@ export const options = {
469
436
type : 'string' ,
470
437
} ,
471
438
prettierPath : {
472
- default : undefined ,
473
439
description : 'The path to the "prettier" module used for inline snapshots.' ,
474
440
type : 'string' ,
475
441
} ,
@@ -486,14 +452,12 @@ export const options = {
486
452
type : 'array' ,
487
453
} ,
488
454
resetMocks : {
489
- default : undefined ,
490
455
description :
491
456
'Automatically reset mock state between every test. ' +
492
457
'Equivalent to calling jest.resetAllMocks() between each test.' ,
493
458
type : 'boolean' ,
494
459
} ,
495
460
resetModules : {
496
- default : undefined ,
497
461
description :
498
462
'If enabled, the module registry for every test file will ' +
499
463
'be reset before running each individual test.' ,
@@ -504,7 +468,6 @@ export const options = {
504
468
type : 'string' ,
505
469
} ,
506
470
restoreMocks : {
507
- default : undefined ,
508
471
description :
509
472
'Automatically restore mock state and implementation between every test. ' +
510
473
'Equivalent to calling jest.restoreAllMocks() between each test.' ,
@@ -525,7 +488,6 @@ export const options = {
525
488
} ,
526
489
runInBand : {
527
490
alias : 'i' ,
528
- default : undefined ,
529
491
description :
530
492
'Run all tests serially in the current process (rather than ' +
531
493
'creating a worker pool of child processes that run tests). This ' +
@@ -534,7 +496,6 @@ export const options = {
534
496
type : 'boolean' ,
535
497
} ,
536
498
runTestsByPath : {
537
- default : false ,
538
499
description :
539
500
'Used when provided patterns are exact file paths. This avoids ' +
540
501
'converting them into a regular expression and matching it against ' +
@@ -568,17 +529,14 @@ export const options = {
568
529
type : 'array' ,
569
530
} ,
570
531
showConfig : {
571
- default : undefined ,
572
532
description : 'Print your jest config and then exits.' ,
573
533
type : 'boolean' ,
574
534
} ,
575
535
silent : {
576
- default : undefined ,
577
536
description : 'Prevent tests from printing messages through the console.' ,
578
537
type : 'boolean' ,
579
538
} ,
580
539
skipFilter : {
581
- default : undefined ,
582
540
description :
583
541
'Disables the filter provided by --filter. Useful for CI jobs, or ' +
584
542
'local enforcement when fixing tests.' ,
@@ -606,7 +564,6 @@ export const options = {
606
564
type : 'string' , // number
607
565
} ,
608
566
testLocationInResults : {
609
- default : false ,
610
567
description : 'Add `location` information to the test results' ,
611
568
type : 'boolean' ,
612
569
} ,
@@ -699,7 +656,6 @@ export const options = {
699
656
} ,
700
657
updateSnapshot : {
701
658
alias : 'u' ,
702
- default : undefined ,
703
659
description :
704
660
'Use this flag to re-record snapshots. ' +
705
661
'Can be used together with a test suite pattern or with ' +
@@ -708,32 +664,27 @@ export const options = {
708
664
type : 'boolean' ,
709
665
} ,
710
666
useStderr : {
711
- default : undefined ,
712
667
description : 'Divert all output to stderr.' ,
713
668
type : 'boolean' ,
714
669
} ,
715
670
verbose : {
716
- default : undefined ,
717
671
description :
718
672
'Display individual test results with the test suite hierarchy.' ,
719
673
type : 'boolean' ,
720
674
} ,
721
675
version : {
722
676
alias : 'v' ,
723
- default : undefined ,
724
677
description : 'Print the version and exit' ,
725
678
type : 'boolean' ,
726
679
} ,
727
680
watch : {
728
- default : undefined ,
729
681
description :
730
682
'Watch files for changes and rerun tests related to ' +
731
683
'changed files. If you want to re-run all tests when a file has ' +
732
684
'changed, use the `--watchAll` option.' ,
733
685
type : 'boolean' ,
734
686
} ,
735
687
watchAll : {
736
- default : undefined ,
737
688
description :
738
689
'Watch files for changes and rerun all tests. If you want ' +
739
690
'to re-run only the tests related to the changed files, use the ' +
@@ -749,7 +700,6 @@ export const options = {
749
700
type : 'array' ,
750
701
} ,
751
702
watchman : {
752
- default : undefined ,
753
703
description :
754
704
'Whether to use watchman for file crawling. Disable using ' +
755
705
'--no-watchman.' ,
0 commit comments