diff --git a/CHANGELOG.md b/CHANGELOG.md index 388e3585043e..42d46e6eb8ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - `[jest-environment-jsdom]` Add `@types/jsdom` dependency ([#11999](https://github.com/facebook/jest/pull/11999)) - `[jest-environment-jsdom]` Do not reset the global.document too early on teardown ([#11871](https://github.com/facebook/jest/pull/11871)) - `[jest-transform]` Improve error and warning messages ([#11998](https://github.com/facebook/jest/pull/11998)) +- `[docs]` CLI options alphabetized ([#11586](https://github.com/facebook/jest/pull/11586)) ### Chore & Maintenance diff --git a/docs/CLI.md b/docs/CLI.md index e22c5df733e8..2c74feb3138e 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -220,10 +220,6 @@ _Note: This option is only supported using the default `jest-circus` test runner Prints the test results in JSON. This mode will send all other test output and user messages to stderr. -### `--outputFile=` - -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). - ### `--lastCommit` 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 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). +### `--outputFile=` + +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). + ### `--passWithNoTests` 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. 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. -### `--selectProjects ... ` - -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. - ### `--runTestsByPath` Run only the tests that were specified with their exact paths. _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_ +### `--selectProjects ... ` + +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. + ### `--setupFilesAfterEnv ... ` 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. A JSON string with options that will be passed to the `testEnvironment`. The relevant options depend on the environment. -### `--testNamePattern=` - -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`. - -_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._ - ### `--testLocationInResults` Adds a `location` field to test results. Useful if you want to report the location of a test in a reporter. @@ -325,9 +319,11 @@ Note that `column` is 0-indexed while `line` is not. } ``` -### `--testPathPattern=` +### `--testNamePattern=` -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 `\\`. +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. + +Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks. ### `--testPathIgnorePatterns=|[array]` @@ -335,6 +331,10 @@ A single or array of regexp pattern strings that are tested against all tests pa 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. +### `--testPathPattern=` + +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 `\\`. + ### `--testRunner=` Lets you specify a custom test runner. diff --git a/website/versioned_docs/version-25.x/CLI.md b/website/versioned_docs/version-25.x/CLI.md index 156a6f42681c..b4ced67f6e51 100644 --- a/website/versioned_docs/version-25.x/CLI.md +++ b/website/versioned_docs/version-25.x/CLI.md @@ -286,12 +286,6 @@ Print your Jest config and then exits. Prevent tests from printing messages through the console. -### `--testNamePattern=` - -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`. - -_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._ - ### `--testLocationInResults` Adds a `location` field to test results. Useful if you want to report the location of a test in a reporter. @@ -305,9 +299,11 @@ Note that `column` is 0-indexed while `line` is not. } ``` -### `--testPathPattern=` +### `--testNamePattern=` -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 `\\`. +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`. + +_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._ ### `--testPathIgnorePatterns=|[array]` @@ -315,6 +311,10 @@ A single or array of regexp pattern strings that are tested against all tests pa 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. +### `--testPathPattern=` + +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 `\\`. + ### `--testRunner=` Lets you specify a custom test runner. diff --git a/website/versioned_docs/version-26.x/CLI.md b/website/versioned_docs/version-26.x/CLI.md index 2d4c5fcf389c..a5ce142b62d1 100644 --- a/website/versioned_docs/version-26.x/CLI.md +++ b/website/versioned_docs/version-26.x/CLI.md @@ -280,16 +280,16 @@ A list of paths to directories that Jest should use to search for files in. 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. -### `--selectProjects ... ` - -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. - ### `--runTestsByPath` Run only the tests that were specified with their exact paths. _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_ +### `--selectProjects ... ` + +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. + ### `--setupFilesAfterEnv ... ` 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. Prevent tests from printing messages through the console. -### `--testNamePattern=` - -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`. - -_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._ - ### `--testLocationInResults` Adds a `location` field to test results. Useful if you want to report the location of a test in a reporter. @@ -321,9 +315,11 @@ Note that `column` is 0-indexed while `line` is not. } ``` -### `--testPathPattern=` +### `--testNamePattern=` -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 `\\`. +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`. + +_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._ ### `--testPathIgnorePatterns=|[array]` @@ -331,6 +327,10 @@ A single or array of regexp pattern strings that are tested against all tests pa 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. +### `--testPathPattern=` + +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 `\\`. + ### `--testRunner=` Lets you specify a custom test runner. diff --git a/website/versioned_docs/version-27.0/CLI.md b/website/versioned_docs/version-27.0/CLI.md index 437254712a87..f54a685d3250 100644 --- a/website/versioned_docs/version-27.0/CLI.md +++ b/website/versioned_docs/version-27.0/CLI.md @@ -280,16 +280,16 @@ A list of paths to directories that Jest should use to search for files in. 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. -### `--selectProjects ... ` - -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. - ### `--runTestsByPath` Run only the tests that were specified with their exact paths. _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_ +### `--selectProjects ... ` + +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. + ### `--setupFilesAfterEnv ... ` 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. Prevent tests from printing messages through the console. -### `--testNamePattern=` - -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`. - -_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._ - ### `--testLocationInResults` Adds a `location` field to test results. Useful if you want to report the location of a test in a reporter. @@ -321,9 +315,11 @@ Note that `column` is 0-indexed while `line` is not. } ``` -### `--testPathPattern=` +### `--testNamePattern=` -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 `\\`. +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`. + +_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._ ### `--testPathIgnorePatterns=|[array]` @@ -331,6 +327,10 @@ A single or array of regexp pattern strings that are tested against all tests pa 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. +### `--testPathPattern=` + +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 `\\`. + ### `--testRunner=` Lets you specify a custom test runner. diff --git a/website/versioned_docs/version-27.1/CLI.md b/website/versioned_docs/version-27.1/CLI.md index 437254712a87..f54a685d3250 100644 --- a/website/versioned_docs/version-27.1/CLI.md +++ b/website/versioned_docs/version-27.1/CLI.md @@ -280,16 +280,16 @@ A list of paths to directories that Jest should use to search for files in. 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. -### `--selectProjects ... ` - -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. - ### `--runTestsByPath` Run only the tests that were specified with their exact paths. _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_ +### `--selectProjects ... ` + +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. + ### `--setupFilesAfterEnv ... ` 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. Prevent tests from printing messages through the console. -### `--testNamePattern=` - -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`. - -_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._ - ### `--testLocationInResults` Adds a `location` field to test results. Useful if you want to report the location of a test in a reporter. @@ -321,9 +315,11 @@ Note that `column` is 0-indexed while `line` is not. } ``` -### `--testPathPattern=` +### `--testNamePattern=` -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 `\\`. +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`. + +_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._ ### `--testPathIgnorePatterns=|[array]` @@ -331,6 +327,10 @@ A single or array of regexp pattern strings that are tested against all tests pa 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. +### `--testPathPattern=` + +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 `\\`. + ### `--testRunner=` Lets you specify a custom test runner. diff --git a/website/versioned_docs/version-27.2/CLI.md b/website/versioned_docs/version-27.2/CLI.md index e22c5df733e8..4ef5661b28d3 100644 --- a/website/versioned_docs/version-27.2/CLI.md +++ b/website/versioned_docs/version-27.2/CLI.md @@ -280,16 +280,16 @@ A list of paths to directories that Jest should use to search for files in. 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. -### `--selectProjects ... ` - -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. - ### `--runTestsByPath` Run only the tests that were specified with their exact paths. _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_ +### `--selectProjects ... ` + +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. + ### `--setupFilesAfterEnv ... ` 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. A JSON string with options that will be passed to the `testEnvironment`. The relevant options depend on the environment. -### `--testNamePattern=` - -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`. - -_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._ - ### `--testLocationInResults` Adds a `location` field to test results. Useful if you want to report the location of a test in a reporter. @@ -325,9 +319,11 @@ Note that `column` is 0-indexed while `line` is not. } ``` -### `--testPathPattern=` +### `--testNamePattern=` -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 `\\`. +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`. + +_Note: The regex is matched against the full name, which is a combination of the test name and all its surrounding describe blocks._ ### `--testPathIgnorePatterns=|[array]` @@ -335,6 +331,10 @@ A single or array of regexp pattern strings that are tested against all tests pa 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. +### `--testPathPattern=` + +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 `\\`. + ### `--testRunner=` Lets you specify a custom test runner.