-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathjest.ts
392 lines (391 loc) · 10.6 KB
/
jest.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
const completionSpec: Fig.Spec = {
name: "jest",
description:
"A delightful JavaScript Testing Framework with a focus on simplicity",
args: {},
options: [
{
name: ["--bail", "-b"],
description:
"Exit the test suite immediately upon n number of failing test suite. Defaults to 1",
args: {
name: "n",
},
},
{
name: "--cache",
description: "Whether to use the cache",
},
{
name: "--no-cache",
description: "Whether to use the cache",
},
{
name: "--changedFilesWithAncestor",
description:
"Runs tests related to the current changes and the changes made in the last commit",
},
{
name: "--changedSince",
description:
"Runs tests related to the changes since the provided branch or commit hash",
args: {
name: "since",
},
},
{
name: "--ci",
description:
"Instead of the regular behavior of storing a new snapshot automatically, will fail the test and require Jest to be run with --updateSnapshot",
},
{
name: "--clearCache",
description:
"Deletes the Jest cache directory and then exits without running tests",
args: {
name: "cacheDirectory",
},
},
{
name: "--collectCoverageFrom",
displayName: "--collectCoverageFrom=<glob>",
requiresSeparator: true,
description:
"A glob pattern relative to rootDir matching the files that coverage info needs to be collected from",
args: {
name: "glob",
},
},
{
name: "--colors",
description:
"Forces test results output highlighting even if stdout is not a TTY",
},
{
name: ["--config", "-c"],
displayName: "--config=<path>",
requiresSeparator: true,
description:
"The path to a Jest config file specifying how to find and execute tests",
args: {
name: "path",
template: "filepaths",
},
},
{
name: "--coverage",
displayName: "--coverage=<boolean>",
requiresSeparator: true,
description: "Enable or disable coverage, disabled by default",
args: {
name: "true|false",
suggestions: [
{
name: "true",
},
{
name: "false",
},
],
},
},
{
name: "--coverageProvider",
displayName: "--coverageProvider=<provider>",
requiresSeparator: true,
description:
"Indicates which provider should be used to instrument code for coverage",
args: {
name: "babel|v8",
suggestions: [{ name: "babel" }, { name: "v8" }],
},
},
{
name: "--debug",
description: "Print debugging info about your Jest config",
},
{
name: "--detectOpenHandles",
description:
"Attempt to collect and print open handles preventing Jest from exiting cleanly",
},
{
name: "--env",
displayName: "--env=<environment>",
requiresSeparator: true,
description: "The test environment used for all tests",
args: {
name: "jsdom|node|path/to/env.js",
template: "filepaths",
suggestions: [{ name: "jsdom" }, { name: "node" }],
},
},
{
name: "--errorOnDeprecated",
description: "Make calling deprecated APIs throw helpful error messages",
},
{
name: ["--expand", "-e"],
description:
"Use this flag to show full diffs and errors instead of a patch",
},
{
name: "--findRelatedTests",
displayName: "--findRelatedTests <path1> ... <pathN>",
description:
"Find and run the tests that cover a space separated list of source files that were passed in as arguments",
args: {
name: "<path1> ... <pathN>",
},
},
{
name: "--forceExit",
description: "Force Jest to exit after all tests have completed running",
},
{
name: "--help",
description: "Show the help information",
},
{
name: "--init",
description: "Generate a basic configuration file",
},
{
name: "--injectGlobals",
description:
"Insert Jest's globals (expect, test, describe, beforeEach etc.) into the global environment",
},
{
name: "--json",
description: "Prints the test results in JSON",
},
{
name: "--outputFile",
displayName: "--outputFile=<filename>",
requiresSeparator: true,
description:
"Write test results to a file when the --json option is also specified",
args: {
name: "filename",
},
},
{
name: "--lastCommit",
description:
"Run all tests affected by file changes in the last commit made",
},
{
name: "--listTests",
description:
"Lists all tests as JSON that Jest will run given the arguments, and exits",
},
{
name: "--logHeapUsage",
description: "Logs the heap usage after every test",
},
{
name: "--maxConcurrency",
displayName: "--maxConcurrency=<num>",
requiresSeparator: true,
description:
"Prevents Jest from executing more than the specified amount of tests at the same time",
args: {
name: "num",
},
},
{
name: ["--maxWorkers", "-w"],
displayName: "--maxWorkers=<num>|<string>",
requiresSeparator: true,
description:
"Specifies the maximum number of workers the worker-pool will spawn for running tests",
args: {
name: "<num>|<string>",
},
},
{
name: "--noStackTrace",
description: "Disables stack trace in test results output",
},
{
name: "--notify",
description: "Activates notifications for test results",
},
{
name: ["--onlyChanged", "-o"],
description:
"Attempts to identify which tests to run based on which files have changed in the current repository",
},
{
name: "--passWithNoTests",
description: "Allows the test suite to pass when no files are found",
},
{
name: "--projects",
displayName: "--projects <path1> ... <pathN>",
description:
"Run tests from one or more projects, found in the specified paths; also takes path globs",
args: {
name: "<path1> ... <pathN>",
isVariadic: true,
template: "filepaths",
},
},
{
name: "--reporters",
displayName: "--reporters=<reporter>",
requiresSeparator: true,
description: "Run tests with specified reporters",
args: {
name: "reporter",
},
},
{
name: "--roots",
displayName: "--roots <path1> ... <pathN>",
description:
"A list of paths to directories that Jest should use to search for files in",
args: {
name: "<path1> ... <pathN>",
isVariadic: true,
template: "folders",
},
},
{
name: ["--runInBand", "-i"],
description:
"Run all tests serially in the current process, rather than creating a worker pool of child processes that run tests",
},
{
name: "--selectProjects",
displayName: "--selectProjects <project1> ... <projectN>",
description: "Run only the tests of the specified projects",
args: {
name: "<project1> ... <projectN>",
},
},
{
name: "--runTestsByPath",
description:
"Run only the tests that were specified with their exact paths",
},
{
name: "--setupTestFrameworkScriptFile",
displayName: "--setupTestFrameworkScriptFile=<file>",
requiresSeparator: true,
description:
"The path to a module that runs some code to configure or set up the testing framework before each test",
args: {
name: "file",
template: "filepaths",
},
},
{
name: "--showConfig",
description: "Print your Jest config and then exits",
},
{
name: "--silent",
description: "Prevent tests from printing messages through the console",
},
{
name: ["--testNamePattern", "-t"],
displayName: "--testNamePattern=<regex>",
requiresSeparator: true,
description: "Run only tests with a name that matches the regex",
args: {
name: "regex",
},
},
{
name: "--testLocationInResults",
description: "Adds a location field to test results",
},
{
name: "--testPathPattern",
displayName: "--testPathPattern=<regex>",
requiresSeparator: true,
description:
"A regexp pattern string that is matched against all tests paths before executing the test",
args: {
name: "regex",
},
},
{
name: "--testPathIgnorePatterns",
displayName: "--testPathIgnorePatterns=[array]",
requiresSeparator: true,
description:
"An array of regexp pattern strings that are tested against all tests paths before executing the test",
args: {
name: "[array]",
},
},
{
name: "--testRunner",
displayName: "--testRunner=<path>",
requiresSeparator: true,
description: "Lets you specify a custom test runner",
args: {
name: "path",
template: "filepaths",
},
},
{
name: "--testSequencer",
displayName: "--testSequencer=<path>",
requiresSeparator: true,
description: "Lets you specify a custom test sequencer",
args: {
name: "path",
template: "filepaths",
},
},
{
name: "--testTimeout",
displayName: "--testTimeout=<num>",
requiresSeparator: true,
description: "Default timeout of a test in milliseconds",
args: {
name: "timeout in ms",
},
},
{
name: ["--updateSnapshot", "-u"],
description:
"Use this flag to re-record every snapshot that fails during this test run",
},
{
name: "--useStderr",
description: "Divert all output to stderr",
},
{
name: "--verbose",
description:
"Display individual test results with the test suite hierarchy",
},
{
name: ["--version", "-v"],
description: "Print the version and exit",
},
{
name: "--watch",
description:
"Watch files for changes and rerun tests related to changed files",
},
{
name: "--watchAll",
description:
"Watch files for changes and rerun all tests when something changes",
},
{
name: "--watchman",
description: "Whether to use watchman for file crawling",
},
{
name: "--no-watchman",
description: "Whether to use watchman for file crawling",
},
],
};
export default completionSpec;