You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4897b10
Browse filesBrowse the repository at this point in the historyBrowse files
fix(cli): expose Vitest 5 options in test help (#2809)
`vp test --help` omits five top-level options accepted by the bundled
Vitest 5, so users cannot discover them through the CLI. The static help
list also still refers to `experimental.fsModuleCache` after that option
moved to the top level.
Add `--repeats`, `--injectCjsGlobals`, `--fsModuleCache`,
`--fsModuleCachePath`, and `--sharedViteServer` with their upstream
descriptions and defaults, and correct the `--clearCache` description.
Update the recorded output for both help aliases. The change is limited
to help text and its snapshots.
Fixes#2804.
---------
Co-authored-by: Charles Wang <me@wan9chi.com>
Copy file name to clipboardExpand all lines: crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/command_helper/snapshots/command_helper.md
+11-10Lines changed: 11 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -311,15 +311,16 @@ Options:
311
311
--dir <path> Base directory to scan for the test files
312
312
--ui Enable UI
313
313
--open Open UI automatically (default: !process.env.CI)
314
-
--api [port] Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to 51204. Use '--help --api' for more info.
314
+
--api [port] Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to 51204 or 63315 in browser mode. Use '--help --api' for more info.
315
315
--silent [value] Silent console output from tests. Use 'passed-only' to see logs from failing tests only.
--outputFile <filename/-s> Write test results to a file when supporter reporter is also specified, use cac's dot notation for individual outputs of multiple reporters (example: --outputFile.tap=./tap.txt)
319
319
--coverage Enable coverage report. Use '--help --coverage' for more info.
320
-
--mode <name> Override Vite mode (default: test or benchmark)
320
+
--mode <name> Override Vite mode (default: test)
321
321
--isolate Run every test file in isolation. To disable isolation, use --no-isolate (default: true)
322
322
--globals Inject apis globally
323
+
--injectCjsGlobals Inject CommonJS variables (module, exports, require, __filename, __dirname) into every test module. To disable, use --no-inject-cjs-globals (default: true)
323
324
--dom Mock browser API with happy-dom
324
325
--browser <name> Run tests in the browser. Equivalent to --browser.enabled (default: false). Use '--help --browser' for more info.
325
326
--pool <pool> Specify pool, if not running in the browser (default: forks)
@@ -342,40 +343,40 @@ Options:
342
343
--hookTimeout <timeout> Default hook timeout in milliseconds (default: 10000). Use 0 to disable timeout completely.
343
344
--bail <number> Stop test execution when given number of tests have failed (default: 0)
344
345
--retry <times> Retry the test specific number of times if it fails (default: 0). Use '--help --retry' for more info.
346
+
--repeats <number> Repeat every test a specific number of times regardless of the result (default: 0)
345
347
--diff <path> DiffOptions object or a path to a module which exports DiffOptions object. Use '--help --diff' for more info.
346
348
--exclude <glob> Additional file globs to be excluded from test
347
349
--expandSnapshotDiff Show full diff when snapshot fails
348
350
--disableConsoleIntercept Disable automatic interception of console logging (default: false)
349
351
--typecheck Enable typechecking alongside tests (default: false). Use '--help --typecheck' for more info.
350
-
--project <name> The name of the project to run if you are using Vitest workspace feature. This can be repeated for multiple projects: --project=1 --project=2. You can also filter projects using wildcards like --project=packages*, and exclude projects with --project=!pattern.
352
+
-p, --project <name> The name of the project to run if you are using Vitest workspace feature. This can be repeated for multiple projects: --project=1 --project=2. You can also filter projects using wildcards like --project=packages*, and exclude projects with --project=!pattern. A project runs if it matches no negated pattern and, when regular patterns are also given, matches at least one of them.
351
353
--slowTestThreshold <threshold> Threshold in milliseconds for a test or suite to be considered slow (default: 300)
352
354
--teardownTimeout <timeout> Default timeout of a teardown function in milliseconds (default: 10000)
353
355
--cache Enable cache. Use '--help --cache' for more info.
354
356
--maxConcurrency <number> Maximum number of concurrent tests and suites during test file execution (default: 5)
357
+
--fsModuleCache Cache transformed modules on the file system and reuse them between reruns (default: false)
358
+
--fsModuleCachePath <path> Directory where the fsModuleCache is stored (default: node_modules/.vitest-cache)
355
359
--expect Configuration options for expect() matches. Use '--help --expect' for more info.
--includeTaskLocation Collect test and suite locations in the location property
358
-
--attachmentsDir <dir> The directory where attachments from context.annotate are stored in (default: .vitest-attachments)
362
+
--attachmentsDir <dir> The directory where attachments from context.annotate are stored in (default: .vitest/attachments)
359
363
--run Disable watch mode
360
364
--no-color Removes colors from the console output (default: true)
361
365
--clearScreen Clear terminal screen when re-running tests during watch mode (default: true)
362
366
--standalone Start Vitest without running tests. Tests will be running only on change. If browser mode is enabled, the UI will be opened automatically. This option is ignored when CLI file filters are passed. (default: false)
363
367
--mergeReports [path] Path to a blob reports directory. If this options is used, Vitest won't run any tests, it will only report previously recorded tests
364
368
--listTags [type] List all available tags instead of running tests. --list-tags=json will output tags in JSON format, unless there are no tags.
365
-
--clearCache Delete all Vitest caches, including experimental.fsModuleCache, without running any tests. This will reduce the performance in the subsequent test run.
369
+
--clearCache Delete all Vitest caches, including the fsModuleCache, without running any tests. This will reduce the performance in the subsequent test run.
366
370
--tagsFilter <expression> Run only tests with the specified tags. You can use logical operators && (and), || (or) and ! (not) to create complex expressions, see https://vitest.dev/guide/test-tags#syntax for more information.
367
371
--strictTags Should Vitest throw an error if test has a tag that is not defined in the config. (default: true)
372
+
--sharedViteServer Let inline projects that don't modify the Vite config reuse the Vite server of the config that declares them. (default: true)
368
373
--experimental <features> Experimental features.. Use '--help --experimental' for more info.
369
374
-h, --help Display this message
370
375
371
-
Bench Options:
372
-
--compare <filename> Benchmark output file to compare against
373
-
--outputJson <filename> Benchmark output file
374
-
375
376
List Options:
376
377
--json [true/path] Print collected tests as JSON or write to a file (Default: false)
377
378
--filesOnly Print only test files with out the test cases
378
-
--staticParse Parse files statically instead of running them to collect tests (default: false)
379
+
--staticParse Parse files statically instead of running them to collect tests (default: true)
379
380
--staticParseConcurrency <limit> How many tests to process at the same time (default: os.availableParallelism())
Copy file name to clipboardExpand all lines: crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/command_tool_help/snapshots/command_tool_help.md
+11-10Lines changed: 11 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,15 +144,16 @@ Options:
144
144
--dir <path> Base directory to scan for the test files
145
145
--ui Enable UI
146
146
--open Open UI automatically (default: !process.env.CI)
147
-
--api [port] Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to 51204. Use '--help --api' for more info.
147
+
--api [port] Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to 51204 or 63315 in browser mode. Use '--help --api' for more info.
148
148
--silent [value] Silent console output from tests. Use 'passed-only' to see logs from failing tests only.
--outputFile <filename/-s> Write test results to a file when supporter reporter is also specified, use cac's dot notation for individual outputs of multiple reporters (example: --outputFile.tap=./tap.txt)
152
152
--coverage Enable coverage report. Use '--help --coverage' for more info.
153
-
--mode <name> Override Vite mode (default: test or benchmark)
153
+
--mode <name> Override Vite mode (default: test)
154
154
--isolate Run every test file in isolation. To disable isolation, use --no-isolate (default: true)
155
155
--globals Inject apis globally
156
+
--injectCjsGlobals Inject CommonJS variables (module, exports, require, __filename, __dirname) into every test module. To disable, use --no-inject-cjs-globals (default: true)
156
157
--dom Mock browser API with happy-dom
157
158
--browser <name> Run tests in the browser. Equivalent to --browser.enabled (default: false). Use '--help --browser' for more info.
158
159
--pool <pool> Specify pool, if not running in the browser (default: forks)
@@ -175,40 +176,40 @@ Options:
175
176
--hookTimeout <timeout> Default hook timeout in milliseconds (default: 10000). Use 0 to disable timeout completely.
176
177
--bail <number> Stop test execution when given number of tests have failed (default: 0)
177
178
--retry <times> Retry the test specific number of times if it fails (default: 0). Use '--help --retry' for more info.
179
+
--repeats <number> Repeat every test a specific number of times regardless of the result (default: 0)
178
180
--diff <path> DiffOptions object or a path to a module which exports DiffOptions object. Use '--help --diff' for more info.
179
181
--exclude <glob> Additional file globs to be excluded from test
180
182
--expandSnapshotDiff Show full diff when snapshot fails
181
183
--disableConsoleIntercept Disable automatic interception of console logging (default: false)
182
184
--typecheck Enable typechecking alongside tests (default: false). Use '--help --typecheck' for more info.
183
-
--project <name> The name of the project to run if you are using Vitest workspace feature. This can be repeated for multiple projects: --project=1 --project=2. You can also filter projects using wildcards like --project=packages*, and exclude projects with --project=!pattern.
185
+
-p, --project <name> The name of the project to run if you are using Vitest workspace feature. This can be repeated for multiple projects: --project=1 --project=2. You can also filter projects using wildcards like --project=packages*, and exclude projects with --project=!pattern. A project runs if it matches no negated pattern and, when regular patterns are also given, matches at least one of them.
184
186
--slowTestThreshold <threshold> Threshold in milliseconds for a test or suite to be considered slow (default: 300)
185
187
--teardownTimeout <timeout> Default timeout of a teardown function in milliseconds (default: 10000)
186
188
--cache Enable cache. Use '--help --cache' for more info.
187
189
--maxConcurrency <number> Maximum number of concurrent tests and suites during test file execution (default: 5)
190
+
--fsModuleCache Cache transformed modules on the file system and reuse them between reruns (default: false)
191
+
--fsModuleCachePath <path> Directory where the fsModuleCache is stored (default: node_modules/.vitest-cache)
188
192
--expect Configuration options for expect() matches. Use '--help --expect' for more info.
--includeTaskLocation Collect test and suite locations in the location property
191
-
--attachmentsDir <dir> The directory where attachments from context.annotate are stored in (default: .vitest-attachments)
195
+
--attachmentsDir <dir> The directory where attachments from context.annotate are stored in (default: .vitest/attachments)
192
196
--run Disable watch mode
193
197
--no-color Removes colors from the console output (default: true)
194
198
--clearScreen Clear terminal screen when re-running tests during watch mode (default: true)
195
199
--standalone Start Vitest without running tests. Tests will be running only on change. If browser mode is enabled, the UI will be opened automatically. This option is ignored when CLI file filters are passed. (default: false)
196
200
--mergeReports [path] Path to a blob reports directory. If this options is used, Vitest won't run any tests, it will only report previously recorded tests
197
201
--listTags [type] List all available tags instead of running tests. --list-tags=json will output tags in JSON format, unless there are no tags.
198
-
--clearCache Delete all Vitest caches, including experimental.fsModuleCache, without running any tests. This will reduce the performance in the subsequent test run.
202
+
--clearCache Delete all Vitest caches, including the fsModuleCache, without running any tests. This will reduce the performance in the subsequent test run.
199
203
--tagsFilter <expression> Run only tests with the specified tags. You can use logical operators && (and), || (or) and ! (not) to create complex expressions, see https://vitest.dev/guide/test-tags#syntax for more information.
200
204
--strictTags Should Vitest throw an error if test has a tag that is not defined in the config. (default: true)
205
+
--sharedViteServer Let inline projects that don't modify the Vite config reuse the Vite server of the config that declares them. (default: true)
201
206
--experimental <features> Experimental features.. Use '--help --experimental' for more info.
202
207
-h, --help Display this message
203
208
204
-
Bench Options:
205
-
--compare <filename> Benchmark output file to compare against
206
-
--outputJson <filename> Benchmark output file
207
-
208
209
List Options:
209
210
--json [true/path] Print collected tests as JSON or write to a file (Default: false)
210
211
--filesOnly Print only test files with out the test cases
211
-
--staticParse Parse files statically instead of running them to collect tests (default: false)
212
+
--staticParse Parse files statically instead of running them to collect tests (default: true)
212
213
--staticParseConcurrency <limit> How many tests to process at the same time (default: os.availableParallelism())
0 commit comments