Skip to content

Commit 7039cb1

Browse files
authored
docs: alphabetize cli options (#11586)
1 parent 2a5e515 commit 7039cb1

7 files changed

Lines changed: 73 additions & 72 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- `[jest-environment-jsdom]` Add `@types/jsdom` dependency ([#11999](https://github.com/facebook/jest/pull/11999))
1515
- `[jest-environment-jsdom]` Do not reset the global.document too early on teardown ([#11871](https://github.com/facebook/jest/pull/11871))
1616
- `[jest-transform]` Improve error and warning messages ([#11998](https://github.com/facebook/jest/pull/11998))
17+
- `[docs]` CLI options alphabetized ([#11586](https://github.com/facebook/jest/pull/11586))
1718

1819
### Chore & Maintenance
1920

docs/CLI.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,6 @@ _Note: This option is only supported using the default `jest-circus` test runner
220220

221221
Prints the test results in JSON. This mode will send all other test output and user messages to stderr.
222222

223-
### `--outputFile=<filename>`
224-
225-
Write test results to a file when the `--json` option is also specified. The returned JSON structure is documented in [testResultsProcessor](Configuration.md#testresultsprocessor-string).
226-
227223
### `--lastCommit`
228224

229225
Run all tests affected by file changes in the last commit made. Behaves similarly to `--onlyChanged`.
@@ -258,6 +254,10 @@ Activates notifications for test results. Good for when you don't want your cons
258254

259255
Alias: `-o`. Attempts to identify which tests to run based on which files have changed in the current repository. Only works if you're running tests in a git/hg repository at the moment and requires a static dependency graph (ie. no dynamic requires).
260256

257+
### `--outputFile=<filename>`
258+
259+
Write test results to a file when the `--json` option is also specified. The returned JSON structure is documented in [testResultsProcessor](Configuration.md#testresultsprocessor-string).
260+
261261
### `--passWithNoTests`
262262

263263
Allows the test suite to pass when no files are found.
@@ -280,16 +280,16 @@ A list of paths to directories that Jest should use to search for files in.
280280

281281
Alias: `-i`. Run all tests serially in the current process, rather than creating a worker pool of child processes that run tests. This can be useful for debugging.
282282

283-
### `--selectProjects <project1> ... <projectN>`
284-
285-
Run only the tests of the specified projects. Jest uses the attribute `displayName` in the configuration to identify each project. If you use this option, you should provide a `displayName` to all your projects.
286-
287283
### `--runTestsByPath`
288284

289285
Run only the tests that were specified with their exact paths.
290286

291287
_Note: The default regex matching works fine on small runs, but becomes slow if provided with multiple patterns and/or against a lot of tests. This option replaces the regex matching logic and by that optimizes the time it takes Jest to filter specific test files_
292288

289+
### `--selectProjects <project1> ... <projectN>`
290+
291+
Run only the tests of the specified projects. Jest uses the attribute `displayName` in the configuration to identify each project. If you use this option, you should provide a `displayName` to all your projects.
292+
293293
### `--setupFilesAfterEnv <path1> ... <pathN>`
294294

295295
A list of paths to modules that run some code to configure or to set up the testing framework before each test. Beware that files imported by the setup scripts will not be mocked during testing.
@@ -306,12 +306,6 @@ Prevent tests from printing messages through the console.
306306

307307
A JSON string with options that will be passed to the `testEnvironment`. The relevant options depend on the environment.
308308

309-
### `--testNamePattern=<regex>`
310-
311-
Alias: `-t`. Run only tests with a name that matches the regex. For example, suppose you want to run only tests related to authorization which will have names like `"GET /api/posts with auth"`, then you can use `jest -t=auth`.
312-
313-
_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._
314-
315309
### `--testLocationInResults`
316310

317311
Adds a `location` field to test results. Useful if you want to report the location of a test in a reporter.
@@ -325,16 +319,22 @@ Note that `column` is 0-indexed while `line` is not.
325319
}
326320
```
327321

328-
### `--testPathPattern=<regex>`
322+
### `--testNamePattern=<regex>`
329323

330-
A regexp pattern string that is matched against all tests paths before executing the test. On Windows, you will need to use `/` as a path separator or escape `\` as `\\`.
324+
Alias: -t. Run only tests with a name that matches the regex. For example, suppose you want to run only tests related to authorization which will have names like "GET /api/posts with auth", then you can use jest -t=auth.
325+
326+
Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks.
331327

332328
### `--testPathIgnorePatterns=<regex>|[array]`
333329

334330
A single or array of regexp pattern strings that are tested against all tests paths before executing the test. Contrary to `--testPathPattern`, it will only run those tests with a path that does not match with the provided regexp expressions.
335331

336332
To pass as an array use escaped parentheses and space delimited regexps such as `\(/node_modules/ /tests/e2e/\)`. Alternatively, you can omit parentheses by combining regexps into a single regexp like `/node_modules/|/tests/e2e/`. These two examples are equivalent.
337333

334+
### `--testPathPattern=<regex>`
335+
336+
A regexp pattern string that is matched against all tests paths before executing the test. On Windows, you will need to use `/` as a path separator or escape `\` as `\\`.
337+
338338
### `--testRunner=<path>`
339339

340340
Lets you specify a custom test runner.

website/versioned_docs/version-25.x/CLI.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,6 @@ Print your Jest config and then exits.
286286

287287
Prevent tests from printing messages through the console.
288288

289-
### `--testNamePattern=<regex>`
290-
291-
Alias: `-t`. Run only tests with a name that matches the regex. For example, suppose you want to run only tests related to authorization which will have names like `"GET /api/posts with auth"`, then you can use `jest -t=auth`.
292-
293-
_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._
294-
295289
### `--testLocationInResults`
296290

297291
Adds a `location` field to test results. Useful if you want to report the location of a test in a reporter.
@@ -305,16 +299,22 @@ Note that `column` is 0-indexed while `line` is not.
305299
}
306300
```
307301

308-
### `--testPathPattern=<regex>`
302+
### `--testNamePattern=<regex>`
309303

310-
A regexp pattern string that is matched against all tests paths before executing the test. On Windows, you will need to use `/` as a path separator or escape `\` as `\\`.
304+
Alias: `-t`. Run only tests with a name that matches the regex. For example, suppose you want to run only tests related to authorization which will have names like `"GET /api/posts with auth"`, then you can use `jest -t=auth`.
305+
306+
_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._
311307

312308
### `--testPathIgnorePatterns=<regex>|[array]`
313309

314310
A single or array of regexp pattern strings that are tested against all tests paths before executing the test. Contrary to `--testPathPattern`, it will only run those tests with a path that does not match with the provided regexp expressions.
315311

316312
To pass as an array use escaped parentheses and space delimited regexps such as `\(/node_modules/ /tests/e2e/\)`. Alternatively, you can omit parentheses by combining regexps into a single regexp like `/node_modules/|/tests/e2e/`. These two examples are equivalent.
317313

314+
### `--testPathPattern=<regex>`
315+
316+
A regexp pattern string that is matched against all tests paths before executing the test. On Windows, you will need to use `/` as a path separator or escape `\` as `\\`.
317+
318318
### `--testRunner=<path>`
319319

320320
Lets you specify a custom test runner.

website/versioned_docs/version-26.x/CLI.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -280,16 +280,16 @@ A list of paths to directories that Jest should use to search for files in.
280280

281281
Alias: `-i`. Run all tests serially in the current process, rather than creating a worker pool of child processes that run tests. This can be useful for debugging.
282282

283-
### `--selectProjects <project1> ... <projectN>`
284-
285-
Run only the tests of the specified projects. Jest uses the attribute `displayName` in the configuration to identify each project. If you use this option, you should provide a `displayName` to all your projects.
286-
287283
### `--runTestsByPath`
288284

289285
Run only the tests that were specified with their exact paths.
290286

291287
_Note: The default regex matching works fine on small runs, but becomes slow if provided with multiple patterns and/or against a lot of tests. This option replaces the regex matching logic and by that optimizes the time it takes Jest to filter specific test files_
292288

289+
### `--selectProjects <project1> ... <projectN>`
290+
291+
Run only the tests of the specified projects. Jest uses the attribute `displayName` in the configuration to identify each project. If you use this option, you should provide a `displayName` to all your projects.
292+
293293
### `--setupFilesAfterEnv <path1> ... <pathN>`
294294

295295
A list of paths to modules that run some code to configure or to set up the testing framework before each test. Beware that files imported by the setup scripts will not be mocked during testing.
@@ -302,12 +302,6 @@ Print your Jest config and then exits.
302302

303303
Prevent tests from printing messages through the console.
304304

305-
### `--testNamePattern=<regex>`
306-
307-
Alias: `-t`. Run only tests with a name that matches the regex. For example, suppose you want to run only tests related to authorization which will have names like `"GET /api/posts with auth"`, then you can use `jest -t=auth`.
308-
309-
_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._
310-
311305
### `--testLocationInResults`
312306

313307
Adds a `location` field to test results. Useful if you want to report the location of a test in a reporter.
@@ -321,16 +315,22 @@ Note that `column` is 0-indexed while `line` is not.
321315
}
322316
```
323317

324-
### `--testPathPattern=<regex>`
318+
### `--testNamePattern=<regex>`
325319

326-
A regexp pattern string that is matched against all tests paths before executing the test. On Windows, you will need to use `/` as a path separator or escape `\` as `\\`.
320+
Alias: `-t`. Run only tests with a name that matches the regex. For example, suppose you want to run only tests related to authorization which will have names like `"GET /api/posts with auth"`, then you can use `jest -t=auth`.
321+
322+
_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._
327323

328324
### `--testPathIgnorePatterns=<regex>|[array]`
329325

330326
A single or array of regexp pattern strings that are tested against all tests paths before executing the test. Contrary to `--testPathPattern`, it will only run those tests with a path that does not match with the provided regexp expressions.
331327

332328
To pass as an array use escaped parentheses and space delimited regexps such as `\(/node_modules/ /tests/e2e/\)`. Alternatively, you can omit parentheses by combining regexps into a single regexp like `/node_modules/|/tests/e2e/`. These two examples are equivalent.
333329

330+
### `--testPathPattern=<regex>`
331+
332+
A regexp pattern string that is matched against all tests paths before executing the test. On Windows, you will need to use `/` as a path separator or escape `\` as `\\`.
333+
334334
### `--testRunner=<path>`
335335

336336
Lets you specify a custom test runner.

website/versioned_docs/version-27.0/CLI.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -280,16 +280,16 @@ A list of paths to directories that Jest should use to search for files in.
280280

281281
Alias: `-i`. Run all tests serially in the current process, rather than creating a worker pool of child processes that run tests. This can be useful for debugging.
282282

283-
### `--selectProjects <project1> ... <projectN>`
284-
285-
Run only the tests of the specified projects. Jest uses the attribute `displayName` in the configuration to identify each project. If you use this option, you should provide a `displayName` to all your projects.
286-
287283
### `--runTestsByPath`
288284

289285
Run only the tests that were specified with their exact paths.
290286

291287
_Note: The default regex matching works fine on small runs, but becomes slow if provided with multiple patterns and/or against a lot of tests. This option replaces the regex matching logic and by that optimizes the time it takes Jest to filter specific test files_
292288

289+
### `--selectProjects <project1> ... <projectN>`
290+
291+
Run only the tests of the specified projects. Jest uses the attribute `displayName` in the configuration to identify each project. If you use this option, you should provide a `displayName` to all your projects.
292+
293293
### `--setupFilesAfterEnv <path1> ... <pathN>`
294294

295295
A list of paths to modules that run some code to configure or to set up the testing framework before each test. Beware that files imported by the setup scripts will not be mocked during testing.
@@ -302,12 +302,6 @@ Print your Jest config and then exits.
302302

303303
Prevent tests from printing messages through the console.
304304

305-
### `--testNamePattern=<regex>`
306-
307-
Alias: `-t`. Run only tests with a name that matches the regex. For example, suppose you want to run only tests related to authorization which will have names like `"GET /api/posts with auth"`, then you can use `jest -t=auth`.
308-
309-
_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._
310-
311305
### `--testLocationInResults`
312306

313307
Adds a `location` field to test results. Useful if you want to report the location of a test in a reporter.
@@ -321,16 +315,22 @@ Note that `column` is 0-indexed while `line` is not.
321315
}
322316
```
323317

324-
### `--testPathPattern=<regex>`
318+
### `--testNamePattern=<regex>`
325319

326-
A regexp pattern string that is matched against all tests paths before executing the test. On Windows, you will need to use `/` as a path separator or escape `\` as `\\`.
320+
Alias: `-t`. Run only tests with a name that matches the regex. For example, suppose you want to run only tests related to authorization which will have names like `"GET /api/posts with auth"`, then you can use `jest -t=auth`.
321+
322+
_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._
327323

328324
### `--testPathIgnorePatterns=<regex>|[array]`
329325

330326
A single or array of regexp pattern strings that are tested against all tests paths before executing the test. Contrary to `--testPathPattern`, it will only run those tests with a path that does not match with the provided regexp expressions.
331327

332328
To pass as an array use escaped parentheses and space delimited regexps such as `\(/node_modules/ /tests/e2e/\)`. Alternatively, you can omit parentheses by combining regexps into a single regexp like `/node_modules/|/tests/e2e/`. These two examples are equivalent.
333329

330+
### `--testPathPattern=<regex>`
331+
332+
A regexp pattern string that is matched against all tests paths before executing the test. On Windows, you will need to use `/` as a path separator or escape `\` as `\\`.
333+
334334
### `--testRunner=<path>`
335335

336336
Lets you specify a custom test runner.

website/versioned_docs/version-27.1/CLI.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -280,16 +280,16 @@ A list of paths to directories that Jest should use to search for files in.
280280

281281
Alias: `-i`. Run all tests serially in the current process, rather than creating a worker pool of child processes that run tests. This can be useful for debugging.
282282

283-
### `--selectProjects <project1> ... <projectN>`
284-
285-
Run only the tests of the specified projects. Jest uses the attribute `displayName` in the configuration to identify each project. If you use this option, you should provide a `displayName` to all your projects.
286-
287283
### `--runTestsByPath`
288284

289285
Run only the tests that were specified with their exact paths.
290286

291287
_Note: The default regex matching works fine on small runs, but becomes slow if provided with multiple patterns and/or against a lot of tests. This option replaces the regex matching logic and by that optimizes the time it takes Jest to filter specific test files_
292288

289+
### `--selectProjects <project1> ... <projectN>`
290+
291+
Run only the tests of the specified projects. Jest uses the attribute `displayName` in the configuration to identify each project. If you use this option, you should provide a `displayName` to all your projects.
292+
293293
### `--setupFilesAfterEnv <path1> ... <pathN>`
294294

295295
A list of paths to modules that run some code to configure or to set up the testing framework before each test. Beware that files imported by the setup scripts will not be mocked during testing.
@@ -302,12 +302,6 @@ Print your Jest config and then exits.
302302

303303
Prevent tests from printing messages through the console.
304304

305-
### `--testNamePattern=<regex>`
306-
307-
Alias: `-t`. Run only tests with a name that matches the regex. For example, suppose you want to run only tests related to authorization which will have names like `"GET /api/posts with auth"`, then you can use `jest -t=auth`.
308-
309-
_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._
310-
311305
### `--testLocationInResults`
312306

313307
Adds a `location` field to test results. Useful if you want to report the location of a test in a reporter.
@@ -321,16 +315,22 @@ Note that `column` is 0-indexed while `line` is not.
321315
}
322316
```
323317

324-
### `--testPathPattern=<regex>`
318+
### `--testNamePattern=<regex>`
325319

326-
A regexp pattern string that is matched against all tests paths before executing the test. On Windows, you will need to use `/` as a path separator or escape `\` as `\\`.
320+
Alias: `-t`. Run only tests with a name that matches the regex. For example, suppose you want to run only tests related to authorization which will have names like `"GET /api/posts with auth"`, then you can use `jest -t=auth`.
321+
322+
_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._
327323

328324
### `--testPathIgnorePatterns=<regex>|[array]`
329325

330326
A single or array of regexp pattern strings that are tested against all tests paths before executing the test. Contrary to `--testPathPattern`, it will only run those tests with a path that does not match with the provided regexp expressions.
331327

332328
To pass as an array use escaped parentheses and space delimited regexps such as `\(/node_modules/ /tests/e2e/\)`. Alternatively, you can omit parentheses by combining regexps into a single regexp like `/node_modules/|/tests/e2e/`. These two examples are equivalent.
333329

330+
### `--testPathPattern=<regex>`
331+
332+
A regexp pattern string that is matched against all tests paths before executing the test. On Windows, you will need to use `/` as a path separator or escape `\` as `\\`.
333+
334334
### `--testRunner=<path>`
335335

336336
Lets you specify a custom test runner.

0 commit comments

Comments
 (0)