From e7bc1549079ea9d0df9248f11e4d69ccd2585ee6 Mon Sep 17 00:00:00 2001 From: NoiseFan Date: Tue, 21 Apr 2026 18:55:42 +0800 Subject: [PATCH] docs(typo): fix doucment's some typo (#10083) --- docs/api/advanced/vitest.md | 2 +- docs/api/assert.md | 4 +- docs/api/expect.md | 34 ++++++------- docs/config/allowonly.md | 4 +- docs/config/bail.md | 2 +- docs/config/browser/provider.md | 2 +- docs/config/cache.md | 4 +- docs/config/coverage.md | 2 +- docs/config/css.md | 18 +++---- .../dangerouslyignoreunhandlederrors.md | 4 +- docs/config/deps.md | 2 +- docs/config/diff.md | 28 +++++------ docs/config/forcereruntriggers.md | 2 +- docs/config/logheapusage.md | 4 +- docs/config/maxconcurrency.md | 6 +-- docs/config/mode.md | 2 +- docs/config/onstacktrace.md | 2 +- docs/config/passwithnotests.md | 4 +- docs/config/pool.md | 2 +- docs/config/resolvesnapshotpath.md | 4 +- docs/config/runner.md | 4 +- docs/config/sequence.md | 48 +++++++++---------- docs/config/slowtestthreshold.md | 6 +-- docs/config/testnamepattern.md | 2 +- docs/config/typecheck.md | 44 ++++++++--------- docs/guide/cli.md | 8 ++-- 26 files changed, 122 insertions(+), 122 deletions(-) diff --git a/docs/api/advanced/vitest.md b/docs/api/advanced/vitest.md index 83c2d23c2..d4eed1bf0 100644 --- a/docs/api/advanced/vitest.md +++ b/docs/api/advanced/vitest.md @@ -244,7 +244,7 @@ This method is called automatically by [`startVitest`](/guide/advanced/tests) if function standalone(): Promise ``` -- **Alias**: `init` +- **Alias:** `init` Initialize reporters and the coverage provider. This method doesn't run any tests. If the `--watch` flag is provided, Vitest will still run changed tests even if this method was not called. diff --git a/docs/api/assert.md b/docs/api/assert.md index a7329a2b9..a10d06634 100644 --- a/docs/api/assert.md +++ b/docs/api/assert.md @@ -36,7 +36,7 @@ test('assert.fail', () => { ## isOk - **Type:** `(value: T, message?: string) => asserts value` -- **Alias** `ok` +- **Alias:** `ok` Assert that the given `value` is truthy. @@ -52,7 +52,7 @@ test('assert.isOk', () => { ## isNotOk - **Type:** `(value: T, message?: string) => void` -- **Alias** `notOk` +- **Alias:** `notOk` Assert that the given `value` is falsy. diff --git a/docs/api/expect.md b/docs/api/expect.md index 483743923..c5ac57ee8 100644 --- a/docs/api/expect.md +++ b/docs/api/expect.md @@ -1075,7 +1075,7 @@ test('spy function', () => { ## toHaveBeenCalledTimes -- **Type**: `(amount: number) => Awaitable` +- **Type:** `(amount: number) => Awaitable` This assertion checks if a function was called a certain amount of times. Requires a spy function to be passed to `expect`. @@ -1100,7 +1100,7 @@ test('spy function called two times', () => { ## toHaveBeenCalledWith -- **Type**: `(...args: any[]) => Awaitable` +- **Type:** `(...args: any[]) => Awaitable` This assertion checks if a function was called at least once with certain parameters. Requires a spy function to be passed to `expect`. @@ -1126,7 +1126,7 @@ test('spy function', () => { ## toHaveBeenCalledBefore -- **Type**: `(mock: MockInstance, failIfNoFirstInvocation?: boolean) => Awaitable` +- **Type:** `(mock: MockInstance, failIfNoFirstInvocation?: boolean) => Awaitable` This assertion checks if a `Mock` was called before another `Mock`. @@ -1145,7 +1145,7 @@ test('calls mock1 before mock2', () => { ## toHaveBeenCalledAfter -- **Type**: `(mock: MockInstance, failIfNoFirstInvocation?: boolean) => Awaitable` +- **Type:** `(mock: MockInstance, failIfNoFirstInvocation?: boolean) => Awaitable` This assertion checks if a `Mock` was called after another `Mock`. @@ -1164,7 +1164,7 @@ test('calls mock1 after mock2', () => { ## toHaveBeenCalledExactlyOnceWith -- **Type**: `(...args: any[]) => Awaitable` +- **Type:** `(...args: any[]) => Awaitable` This assertion checks if a function was called exactly once and with certain parameters. Requires a spy function to be passed to `expect`. @@ -1188,7 +1188,7 @@ test('spy function', () => { ## toHaveBeenLastCalledWith -- **Type**: `(...args: any[]) => Awaitable` +- **Type:** `(...args: any[]) => Awaitable` This assertion checks if a function was called with certain parameters at its last invocation. Requires a spy function to be passed to `expect`. @@ -1214,7 +1214,7 @@ test('spy function', () => { ## toHaveBeenNthCalledWith -- **Type**: `(time: number, ...args: any[]) => Awaitable` +- **Type:** `(time: number, ...args: any[]) => Awaitable` This assertion checks if a function was called with certain parameters at the certain time. The count starts at 1. So, to check the second entry, you would write `.toHaveBeenNthCalledWith(2, ...)`. @@ -1241,7 +1241,7 @@ test('first call of spy function called with right params', () => { ## toHaveReturned -- **Type**: `() => Awaitable` +- **Type:** `() => Awaitable` This assertion checks if a function has successfully returned a value at least once (i.e., did not throw an error). Requires a spy function to be passed to `expect`. @@ -1265,7 +1265,7 @@ test('spy function returned a value', () => { ## toHaveReturnedTimes -- **Type**: `(amount: number) => Awaitable` +- **Type:** `(amount: number) => Awaitable` This assertion checks if a function has successfully returned a value an exact amount of times (i.e., did not throw an error). Requires a spy function to be passed to `expect`. @@ -1284,7 +1284,7 @@ test('spy function returns a value two times', () => { ## toHaveReturnedWith -- **Type**: `(returnValue: any) => Awaitable` +- **Type:** `(returnValue: any) => Awaitable` You can call this assertion to check if a function has successfully returned a value with certain parameters at least once. Requires a spy function to be passed to `expect`. @@ -1302,7 +1302,7 @@ test('spy function returns a product', () => { ## toHaveLastReturnedWith -- **Type**: `(returnValue: any) => Awaitable` +- **Type:** `(returnValue: any) => Awaitable` You can call this assertion to check if a function has successfully returned a certain value when it was last invoked. Requires a spy function to be passed to `expect`. @@ -1321,7 +1321,7 @@ test('spy function returns bananas on a last call', () => { ## toHaveNthReturnedWith -- **Type**: `(time: number, returnValue: any) => Awaitable` +- **Type:** `(time: number, returnValue: any) => Awaitable` You can call this assertion to check if a function has successfully returned a value with certain parameters on a certain call. Requires a spy function to be passed to `expect`. @@ -1342,7 +1342,7 @@ test('spy function returns bananas on second call', () => { ## toHaveResolved -- **Type**: `() => Awaitable` +- **Type:** `() => Awaitable` This assertion checks if a function has successfully resolved a value at least once (i.e., did not reject). Requires a spy function to be passed to `expect`. @@ -1368,7 +1368,7 @@ test('spy function resolved a value', async () => { ## toHaveResolvedTimes -- **Type**: `(amount: number) => Awaitable` +- **Type:** `(amount: number) => Awaitable` This assertion checks if a function has successfully resolved a value an exact amount of times (i.e., did not reject). Requires a spy function to be passed to `expect`. @@ -1389,7 +1389,7 @@ test('spy function resolved a value two times', async () => { ## toHaveResolvedWith -- **Type**: `(returnValue: any) => Awaitable` +- **Type:** `(returnValue: any) => Awaitable` You can call this assertion to check if a function has successfully resolved a certain value at least once. Requires a spy function to be passed to `expect`. @@ -1409,7 +1409,7 @@ test('spy function resolved a product', async () => { ## toHaveLastResolvedWith -- **Type**: `(returnValue: any) => Awaitable` +- **Type:** `(returnValue: any) => Awaitable` You can call this assertion to check if a function has successfully resolved a certain value when it was last invoked. Requires a spy function to be passed to `expect`. @@ -1430,7 +1430,7 @@ test('spy function resolves bananas on a last call', async () => { ## toHaveNthResolvedWith -- **Type**: `(time: number, returnValue: any) => Awaitable` +- **Type:** `(time: number, returnValue: any) => Awaitable` You can call this assertion to check if a function has successfully resolved a certain value on a specific invocation. Requires a spy function to be passed to `expect`. diff --git a/docs/config/allowonly.md b/docs/config/allowonly.md index 39fd86113..6c75bed70 100644 --- a/docs/config/allowonly.md +++ b/docs/config/allowonly.md @@ -5,8 +5,8 @@ outline: deep # allowOnly -- **Type**: `boolean` -- **Default**: `!process.env.CI` +- **Type:** `boolean` +- **Default:** `!process.env.CI` - **CLI:** `--allowOnly`, `--allowOnly=false` By default, Vitest does not permit tests marked with the [`only`](/api/test#test-only) flag in Continuous Integration (CI) environments. Conversely, in local development environments, Vitest allows these tests to run. diff --git a/docs/config/bail.md b/docs/config/bail.md index 27018e562..26c1fc6b8 100644 --- a/docs/config/bail.md +++ b/docs/config/bail.md @@ -7,7 +7,7 @@ outline: deep - **Type:** `number` - **Default:** `0` -- **CLI**: `--bail=` +- **CLI:** `--bail=` Stop test execution when given number of tests have failed. diff --git a/docs/config/browser/provider.md b/docs/config/browser/provider.md index c5995fbf4..88eee69d0 100644 --- a/docs/config/browser/provider.md +++ b/docs/config/browser/provider.md @@ -61,7 +61,7 @@ export default defineConfig({ }) ``` -## Custom Provider advanced +## Custom Provider advanced {#custom-provider} ::: danger ADVANCED API The custom provider API is highly experimental and can change between patches. If you just need to run tests in a browser, use the [`browser.instances`](/config/browser/instances) option instead. diff --git a/docs/config/cache.md b/docs/config/cache.md index a480f6284..2c7058e6d 100644 --- a/docs/config/cache.md +++ b/docs/config/cache.md @@ -5,8 +5,8 @@ outline: deep # cache -- **Type**: `false` -- **CLI**: `--no-cache`, `--cache=false` +- **Type:** `false` +- **CLI:** `--no-cache`, `--cache=false` Use this option if you want to disable the cache feature. At the moment Vitest stores cache for test results to run the longer and failed tests first. diff --git a/docs/config/coverage.md b/docs/config/coverage.md index 461466deb..d74568312 100644 --- a/docs/config/coverage.md +++ b/docs/config/coverage.md @@ -65,7 +65,7 @@ See [Including and excluding files from coverage report](/guide/coverage.html#in - **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.clean`, `--coverage.clean=false` -Clean coverage results before running tests +Clean coverage results before running tests. ## coverage.cleanOnRerun diff --git a/docs/config/css.md b/docs/config/css.md index eb096d164..51a4e0b9a 100644 --- a/docs/config/css.md +++ b/docs/config/css.md @@ -5,7 +5,7 @@ outline: deep # css -- **Type**: `boolean | { include?, exclude?, modules? }` +- **Type:** `boolean | { include?, exclude?, modules? }` Configure if CSS should be processed. When excluded, CSS files will be replaced with empty strings to bypass the subsequent processing. CSS Modules will return a proxy to not affect runtime. @@ -15,8 +15,8 @@ This option is not applied to [browser tests](/guide/browser/). ## css.include -- **Type**: `RegExp | RegExp[]` -- **Default**: `[]` +- **Type:** `RegExp | RegExp[]` +- **Default:** `[]` RegExp pattern for files that should return actual CSS and will be processed by Vite pipeline. @@ -26,20 +26,20 @@ To process all CSS files, use `/.+/`. ## css.exclude -- **Type**: `RegExp | RegExp[]` -- **Default**: `[]` +- **Type:** `RegExp | RegExp[]` +- **Default:** `[]` RegExp pattern for files that will return an empty CSS file. ## css.modules -- **Type**: `{ classNameStrategy? }` -- **Default**: `{}` +- **Type:** `{ classNameStrategy? }` +- **Default:** `{}` ### css.modules.classNameStrategy -- **Type**: `'stable' | 'scoped' | 'non-scoped'` -- **Default**: `'stable'` +- **Type:** `'stable' | 'scoped' | 'non-scoped'` +- **Default:** `'stable'` If you decide to process CSS files, you can configure if class names inside CSS modules should be scoped. You can choose one of the options: diff --git a/docs/config/dangerouslyignoreunhandlederrors.md b/docs/config/dangerouslyignoreunhandlederrors.md index 54536f199..a19bf7aa3 100644 --- a/docs/config/dangerouslyignoreunhandlederrors.md +++ b/docs/config/dangerouslyignoreunhandlederrors.md @@ -5,8 +5,8 @@ outline: deep # dangerouslyIgnoreUnhandledErrors -- **Type**: `boolean` -- **Default**: `false` +- **Type:** `boolean` +- **Default:** `false` - **CLI:** - `--dangerouslyIgnoreUnhandledErrors` - `--dangerouslyIgnoreUnhandledErrors=false` diff --git a/docs/config/deps.md b/docs/config/deps.md index 579544e92..15297b9dd 100644 --- a/docs/config/deps.md +++ b/docs/config/deps.md @@ -111,7 +111,7 @@ By default, Vitest assumes you are using a bundler to bypass this and will not f ## deps.moduleDirectories - **Type:** `string[]` -- **Default**: `['node_modules']` +- **Default:** `['node_modules']` A list of directories that should be treated as module directories. This config option affects the behavior of [`vi.mock`](/api/vi#vi-mock): when no factory is provided and the path of what you are mocking matches one of the `moduleDirectories` values, Vitest will try to resolve the mock by looking for a `__mocks__` folder in the [root](/config/root) of the project. diff --git a/docs/config/diff.md b/docs/config/diff.md index 710d66dd0..39cd26537 100644 --- a/docs/config/diff.md +++ b/docs/config/diff.md @@ -56,16 +56,16 @@ export default { ## diff.expand -- **Type**: `boolean` -- **Default**: `true` +- **Type:** `boolean` +- **Default:** `true` - **CLI:** `--diff.expand=false` Expand all common lines. ## diff.truncateThreshold -- **Type**: `number` -- **Default**: `0` +- **Type:** `number` +- **Default:** `0` - **CLI:** `--diff.truncateThreshold=` The maximum length of diff result to be displayed. Diffs above this threshold will be truncated. @@ -73,29 +73,29 @@ Truncation won't take effect with default value 0. ## diff.truncateAnnotation -- **Type**: `string` -- **Default**: `'... Diff result is truncated'` +- **Type:** `string` +- **Default:** `'... Diff result is truncated'` - **CLI:** `--diff.truncateAnnotation=` Annotation that is output at the end of diff result if it's truncated. ## diff.truncateAnnotationColor -- **Type**: `DiffOptionsColor = (arg: string) => string` -- **Default**: `noColor = (string: string): string => string` +- **Type:** `DiffOptionsColor = (arg: string) => string` +- **Default:** `noColor = (string: string): string => string` Color of truncate annotation, default is output with no color. ## diff.printBasicPrototype -- **Type**: `boolean` -- **Default**: `false` +- **Type:** `boolean` +- **Default:** `false` -Print basic prototype `Object` and `Array` in diff output +Print basic prototype `Object` and `Array` in diff output. ## diff.maxDepth -- **Type**: `number` -- **Default**: `20` (or `8` when comparing different types) +- **Type:** `number` +- **Default:** `20` (or `8` when comparing different types) -Limit the depth to recurse when printing nested objects +Limit the depth to recurse when printing nested objects. diff --git a/docs/config/forcereruntriggers.md b/docs/config/forcereruntriggers.md index 342143e18..9dad489c4 100644 --- a/docs/config/forcereruntriggers.md +++ b/docs/config/forcereruntriggers.md @@ -5,7 +5,7 @@ outline: deep # forceRerunTriggers -- **Type**: `string[]` +- **Type:** `string[]` - **Default:** `['**/package.json/**', '**/vitest.config.*/**', '**/vite.config.*/**']` Glob pattern of file paths that will trigger the whole suite rerun. When paired with the `--changed` argument will run the whole test suite if the trigger is found in the git diff. diff --git a/docs/config/logheapusage.md b/docs/config/logheapusage.md index a29f251c9..a65df7b02 100644 --- a/docs/config/logheapusage.md +++ b/docs/config/logheapusage.md @@ -5,8 +5,8 @@ outline: deep # logHeapUsage -- **Type**: `boolean` -- **Default**: `false` +- **Type:** `boolean` +- **Default:** `false` - **CLI:** `--logHeapUsage`, `--logHeapUsage=false` Show heap usage after each test. Useful for debugging memory leaks. diff --git a/docs/config/maxconcurrency.md b/docs/config/maxconcurrency.md index deb88476b..b6a707a75 100644 --- a/docs/config/maxconcurrency.md +++ b/docs/config/maxconcurrency.md @@ -5,9 +5,9 @@ outline: deep # maxConcurrency -- **Type**: `number` -- **Default**: `5` -- **CLI**: `--max-concurrency=10`, `--maxConcurrency=10` +- **Type:** `number` +- **Default:** `5` +- **CLI:** `--max-concurrency=10`, `--maxConcurrency=10` The maximum number of tests and hooks that can run at the same time when using `test.concurrent` or `describe.concurrent`. diff --git a/docs/config/mode.md b/docs/config/mode.md index 5e45a97e2..a17786d52 100644 --- a/docs/config/mode.md +++ b/docs/config/mode.md @@ -9,4 +9,4 @@ outline: deep - **CLI:** `--mode=staging` - **Default:** `'test'` -Overrides Vite mode +Overrides Vite mode. diff --git a/docs/config/onstacktrace.md b/docs/config/onstacktrace.md index 3c970589b..ed6a6f702 100644 --- a/docs/config/onstacktrace.md +++ b/docs/config/onstacktrace.md @@ -5,7 +5,7 @@ outline: deep # onStackTrace -- **Type**: `(error: Error, frame: ParsedStack) => boolean | void` +- **Type:** `(error: Error, frame: ParsedStack) => boolean | void` Apply a filtering function to each frame of each stack trace when handling errors. This does not apply to stack traces printed by [`printConsoleTrace`](/config/printconsoletrace#printconsoletrace). The first argument, `error`, is a `TestError`. diff --git a/docs/config/passwithnotests.md b/docs/config/passwithnotests.md index eb4bbe2ed..23ae4da1d 100644 --- a/docs/config/passwithnotests.md +++ b/docs/config/passwithnotests.md @@ -5,8 +5,8 @@ outline: deep # passWithNoTests -- **Type**: `boolean` -- **Default**: `false` +- **Type:** `boolean` +- **Default:** `false` - **CLI:** `--passWithNoTests`, `--passWithNoTests=false` Vitest will not fail, if no tests will be found. diff --git a/docs/config/pool.md b/docs/config/pool.md index c94498188..b98bb9fda 100644 --- a/docs/config/pool.md +++ b/docs/config/pool.md @@ -13,7 +13,7 @@ Pool used to run tests in. ## threads -Enable multi-threading. When using threads you are unable to use process related APIs such as `process.chdir()`. Some libraries written in native languages, such as Prisma, `bcrypt` and `canvas`, have problems when running in multiple threads and run into segfaults. In these cases it is advised to use `forks` pool instead. +Enable multi-threading. When using threads you are unable to use process related APIs such as `process.chdir()`. Some libraries written in native languages, such as `Prisma`, `bcrypt` and `canvas`, have problems when running in multiple threads and run into segfaults. In these cases it is advised to use `forks` pool instead. ## forks diff --git a/docs/config/resolvesnapshotpath.md b/docs/config/resolvesnapshotpath.md index c63abfd55..f3d0ca471 100644 --- a/docs/config/resolvesnapshotpath.md +++ b/docs/config/resolvesnapshotpath.md @@ -5,8 +5,8 @@ outline: deep # resolveSnapshotPath -- **Type**: `(testPath: string, snapExtension: string, context: { config: SerializedConfig }) => string` -- **Default**: stores snapshot files in `__snapshots__` directory +- **Type:** `(testPath: string, snapExtension: string, context: { config: SerializedConfig }) => string` +- **Default:** stores snapshot files in `__snapshots__` directory Overrides default snapshot path. For example, to store snapshots next to test files: diff --git a/docs/config/runner.md b/docs/config/runner.md index aaf20871c..1d47b9537 100644 --- a/docs/config/runner.md +++ b/docs/config/runner.md @@ -5,7 +5,7 @@ outline: deep # runner -- **Type**: `VitestRunnerConstructor` -- **Default**: `node`, when running tests, or `benchmark`, when running benchmarks +- **Type:** `VitestRunnerConstructor` +- **Default:** `node`, when running tests, or `benchmark`, when running benchmarks Path to a custom test runner. This is an advanced feature and should be used with custom library runners. You can read more about it in [the documentation](/api/advanced/runner). diff --git a/docs/config/sequence.md b/docs/config/sequence.md index 51c7276b0..e55f4b82a 100644 --- a/docs/config/sequence.md +++ b/docs/config/sequence.md @@ -5,7 +5,7 @@ outline: deep # sequence -- **Type**: `{ sequencer?, shuffle?, seed?, hooks?, setupFiles?, groupOrder }` +- **Type:** `{ sequencer?, shuffle?, seed?, hooks?, setupFiles?, groupOrder }` Options for how tests should be sorted. @@ -17,8 +17,8 @@ npx vitest --sequence.shuffle --sequence.seed=1000 ## sequence.sequencer -- **Type**: `TestSequencerConstructor` -- **Default**: `BaseSequencer` +- **Type:** `TestSequencerConstructor` +- **Default:** `BaseSequencer` A custom class that defines methods for sharding and sorting. You can extend `BaseSequencer` from `vitest/node`, if you only need to redefine one of the `sort` and `shard` methods, but both should exist. @@ -91,9 +91,9 @@ Tests in these projects will run in this order: ## sequence.shuffle -- **Type**: `boolean | { files?, tests? }` -- **Default**: `false` -- **CLI**: `--sequence.shuffle`, `--sequence.shuffle=false` +- **Type:** `boolean | { files?, tests? }` +- **Default:** `false` +- **CLI:** `--sequence.shuffle`, `--sequence.shuffle=false` If you want files and tests to run randomly, you can enable it with this option, or CLI argument [`--sequence.shuffle`](/guide/cli). @@ -101,25 +101,25 @@ Vitest usually uses cache to sort tests, so long-running tests start earlier, wh ### sequence.shuffle.files {#sequence-shuffle-files} -- **Type**: `boolean` -- **Default**: `false` -- **CLI**: `--sequence.shuffle.files`, `--sequence.shuffle.files=false` +- **Type:** `boolean` +- **Default:** `false` +- **CLI:** `--sequence.shuffle.files`, `--sequence.shuffle.files=false` Whether to randomize files, be aware that long running tests will not start earlier if you enable this option. ### sequence.shuffle.tests {#sequence-shuffle-tests} -- **Type**: `boolean` -- **Default**: `false` -- **CLI**: `--sequence.shuffle.tests`, `--sequence.shuffle.tests=false` +- **Type:** `boolean` +- **Default:** `false` +- **CLI:** `--sequence.shuffle.tests`, `--sequence.shuffle.tests=false` Whether to randomize tests. ## sequence.concurrent {#sequence-concurrent} -- **Type**: `boolean` -- **Default**: `false` -- **CLI**: `--sequence.concurrent`, `--sequence.concurrent=false` +- **Type:** `boolean` +- **Default:** `false` +- **CLI:** `--sequence.concurrent`, `--sequence.concurrent=false` If you want tests to run in parallel, you can enable it with this option, or CLI argument [`--sequence.concurrent`](/guide/cli). @@ -129,17 +129,17 @@ When you run tests with `sequence.concurrent` and `expect.requireAssertions` set ## sequence.seed -- **Type**: `number` -- **Default**: `Date.now()` -- **CLI**: `--sequence.seed=1000` +- **Type:** `number` +- **Default:** `Date.now()` +- **CLI:** `--sequence.seed=1000` Sets the randomization seed, if tests are running in random order. ## sequence.hooks -- **Type**: `'stack' | 'list' | 'parallel'` -- **Default**: `'stack'` -- **CLI**: `--sequence.hooks=` +- **Type:** `'stack' | 'list' | 'parallel'` +- **Default:** `'stack'` +- **CLI:** `--sequence.hooks=` Changes the order in which hooks are executed. @@ -153,9 +153,9 @@ This option doesn't affect [`onTestFinished`](/api/hooks#ontestfinished). It is ## sequence.setupFiles {#sequence-setupfiles} -- **Type**: `'list' | 'parallel'` -- **Default**: `'parallel'` -- **CLI**: `--sequence.setupFiles=` +- **Type:** `'list' | 'parallel'` +- **Default:** `'parallel'` +- **CLI:** `--sequence.setupFiles=` Changes the order in which setup files are executed. diff --git a/docs/config/slowtestthreshold.md b/docs/config/slowtestthreshold.md index 84f9594d2..dc10baa2c 100644 --- a/docs/config/slowtestthreshold.md +++ b/docs/config/slowtestthreshold.md @@ -5,8 +5,8 @@ outline: deep # slowTestThreshold -- **Type**: `number` -- **Default**: `300` -- **CLI**: `--slow-test-threshold=`, `--slowTestThreshold=` +- **Type:** `number` +- **Default:** `300` +- **CLI:** `--slow-test-threshold=`, `--slowTestThreshold=` The number of milliseconds after which a test or suite is considered slow and reported as such in the results. diff --git a/docs/config/testnamepattern.md b/docs/config/testnamepattern.md index 7e4b4098a..c0646e5b8 100644 --- a/docs/config/testnamepattern.md +++ b/docs/config/testnamepattern.md @@ -5,7 +5,7 @@ outline: deep # testNamePattern {#testnamepattern} -- **Type** `string | RegExp` +- **Type:** `string | RegExp` - **CLI:** `-t `, `--testNamePattern=`, `--test-name-pattern=` Run tests with full names matching the pattern. diff --git a/docs/config/typecheck.md b/docs/config/typecheck.md index cae1854ab..4413742ce 100644 --- a/docs/config/typecheck.md +++ b/docs/config/typecheck.md @@ -9,24 +9,24 @@ Options for configuring [typechecking](/guide/testing-types) test environment. ## typecheck.enabled {#typecheck-enabled} -- **Type**: `boolean` -- **Default**: `false` -- **CLI**: `--typecheck`, `--typecheck.enabled` +- **Type:** `boolean` +- **Default:** `false` +- **CLI:** `--typecheck`, `--typecheck.enabled` Enable typechecking alongside your regular tests. ## typecheck.only {#typecheck-only} -- **Type**: `boolean` -- **Default**: `false` -- **CLI**: `--typecheck.only` +- **Type:** `boolean` +- **Default:** `false` +- **CLI:** `--typecheck.only` Run only typecheck tests, when typechecking is enabled. When using CLI, this option will automatically enable typechecking. ## typecheck.checker -- **Type**: `'tsc' | 'vue-tsc' | string` -- **Default**: `tsc` +- **Type:** `'tsc' | 'vue-tsc' | string` +- **Default:** `tsc` What tools to use for type checking. Vitest will spawn a process with certain parameters for easier parsing, depending on the type. Checker should implement the same output format as `tsc`. @@ -39,29 +39,29 @@ You can also pass down a path to custom binary or command name that produces the ## typecheck.include -- **Type**: `string[]` -- **Default**: `['**/*.{test,spec}-d.?(c|m)[jt]s?(x)']` +- **Type:** `string[]` +- **Default:** `['**/*.{test,spec}-d.?(c|m)[jt]s?(x)']` -Glob pattern for files that should be treated as test files +Glob pattern for files that should be treated as test files. ## typecheck.exclude -- **Type**: `string[]` -- **Default**: `['**/node_modules/**', '**/dist/**', '**/cypress/**', '**/.{idea,git,cache,output,temp}/**']` +- **Type:** `string[]` +- **Default:** `['**/node_modules/**', '**/dist/**', '**/cypress/**', '**/.{idea,git,cache,output,temp}/**']` -Glob pattern for files that should not be treated as test files +Glob pattern for files that should not be treated as test files. ## typecheck.allowJs -- **Type**: `boolean` -- **Default**: `false` +- **Type:** `boolean` +- **Default:** `false` Check JS files that have `@ts-check` comment. If you have it enabled in tsconfig, this will not overwrite it. ## typecheck.ignoreSourceErrors -- **Type**: `boolean` -- **Default**: `false` +- **Type:** `boolean` +- **Default:** `false` Do not fail, if Vitest found errors outside the test files. This will not show you non-test errors at all. @@ -69,14 +69,14 @@ By default, if Vitest finds source error, it will fail test suite. ## typecheck.tsconfig -- **Type**: `string` -- **Default**: _tries to find closest tsconfig.json_ +- **Type:** `string` +- **Default:** _tries to find closest tsconfig.json_ Path to custom tsconfig, relative to the project root. ## typecheck.spawnTimeout -- **Type**: `number` -- **Default**: `10_000` +- **Type:** `number` +- **Default:** `10_000` Minimum time in milliseconds it takes to spawn the typechecker. diff --git a/docs/guide/cli.md b/docs/guide/cli.md index e1a16c451..014731736 100644 --- a/docs/guide/cli.md +++ b/docs/guide/cli.md @@ -191,8 +191,8 @@ vitest --api=false ### changed -- **Type**: `boolean | string` -- **Default**: false +- **Type:** `boolean | string` +- **Default:** false Run tests only against changed files. If no value is provided, it will run tests against uncommitted changes (including staged and unstaged). @@ -204,8 +204,8 @@ If paired with the [`forceRerunTriggers`](/config/forcereruntriggers) config opt ### shard -- **Type**: `string` -- **Default**: disabled +- **Type:** `string` +- **Default:** disabled Test suite shard to execute in a format of ``/``, where -- 2.51.2