Skip to content

Commit

Permalink
docs: fix defaults in JSDocs to be more accurate (#5196)
Browse files Browse the repository at this point in the history
Co-authored-by: Vladimir <sleuths.slews0s@icloud.com>
Co-authored-by: Hiroshi Ogawa <hi.ogawa.zz@gmail.com>
  • Loading branch information
3 people authored Feb 20, 2024
1 parent a280451 commit 2f755f0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 10 deletions.
6 changes: 3 additions & 3 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ Update snapshot files. This will update all changed snapshots and delete obsolet
### watch<NonProjectOption />

- **Type:** `boolean`
- **Default:** `true`
- **Default:** `!process.env.CI`
- **CLI:** `-w`, `--watch`, `--watch=false`

Enable watch mode
Expand Down Expand Up @@ -1397,7 +1397,7 @@ test('doNotRun', () => {
### open<NonProjectOption />

- **Type:** `boolean`
- **Default:** `false`
- **Default:** `!process.env.CI`
- **CLI:** `--open`, `--open=false`

Open Vitest UI (WIP)
Expand Down Expand Up @@ -1647,7 +1647,7 @@ export default defineConfig({
### allowOnly

- **Type**: `boolean`
- **Default**: `false`
- **Default**: `!process.env.CI`
- **CLI:** `--allowOnly`, `--allowOnly=false`

Allow tests and suites that are marked as only.
Expand Down
4 changes: 3 additions & 1 deletion packages/vitest/src/types/benchmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface BenchmarkUserOptions {

/**
* Exclude globs for benchmark test files
* @default ['node_modules', 'dist', '.idea', '.git', '.cache']
* @default ['**\/node_modules/**', '**\/dist/**', '**\/cypress/**', '**\/.{idea,git,cache,output,temp}/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']
*/
exclude?: string[]

Expand All @@ -29,6 +29,8 @@ export interface BenchmarkUserOptions {
/**
* Custom reporter for output. Can contain one or more built-in report names, reporter instances,
* and/or paths to custom reporters
*
* @default ['default']
*/
reporters?: Arrayable<BenchmarkBuiltinReporters | Reporter>

Expand Down
22 changes: 18 additions & 4 deletions packages/vitest/src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export interface InlineConfig {

/**
* Exclude globs for test files
* @default ['node_modules', 'dist', '.idea', '.git', '.cache']
* @default ['**\/node_modules/**', '**\/dist/**', '**\/cypress/**', '**\/.{idea,git,cache,output,temp}/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']
*/
exclude?: string[]

Expand Down Expand Up @@ -359,7 +359,7 @@ export interface InlineConfig {
/**
* Watch mode
*
* @default true
* @default !process.env.CI
*/
watch?: boolean

Expand All @@ -373,6 +373,8 @@ export interface InlineConfig {
/**
* Custom reporter for output. Can contain one or more built-in report names, reporter instances,
* and/or paths to custom reporters.
*
* @default []
*/
reporters?: Arrayable<ReporterName | InlineReporter> | ((ReporterName | InlineReporter) | [ReporterName] | ReporterWithOptions)[]

Expand Down Expand Up @@ -439,7 +441,7 @@ export interface InlineConfig {
*
* Useful if you are testing calling CLI commands
*
* @default []
* @default ['**\/package.json/**', '**\/{vitest,vite}.config.*\/**']
*/
forceRerunTriggers?: string[]

Expand Down Expand Up @@ -494,6 +496,8 @@ export interface InlineConfig {

/**
* Enable Vitest UI
*
* @default false
*/
ui?: boolean

Expand All @@ -508,7 +512,7 @@ export interface InlineConfig {
/**
* Open UI automatically.
*
* @default true
* @default !process.env.CI
*/
open?: boolean

Expand Down Expand Up @@ -551,6 +555,8 @@ export interface InlineConfig {

/**
* Allow tests and suites that are marked as only
*
* @default !process.env.CI
*/
allowOnly?: boolean

Expand Down Expand Up @@ -626,6 +632,8 @@ export interface InlineConfig {

/**
* Ignore any unhandled errors that occur
*
* @default false
*/
dangerouslyIgnoreUnhandledErrors?: boolean

Expand Down Expand Up @@ -708,14 +716,20 @@ export interface TypecheckConfig {
only?: boolean
/**
* What tools to use for type checking.
*
* @default 'tsc'
*/
checker: 'tsc' | 'vue-tsc' | (string & Record<never, never>)
/**
* Pattern for files that should be treated as test files
*
* @default ['**\/*.{test,spec}-d.?(c|m)[jt]s?(x)']
*/
include: string[]
/**
* Pattern for files that should not be treated as test files
*
* @default ['**\/node_modules/**', '**\/dist/**', '**\/cypress/**', '**\/.{idea,git,cache,output,temp}/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*']
*/
exclude: string[]
/**
Expand Down
15 changes: 13 additions & 2 deletions packages/vitest/src/types/coverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,14 @@ type Provider = 'v8' | 'istanbul' | 'custom' | undefined

export type CoverageOptions<T extends Provider = Provider> =
T extends 'istanbul' ? ({ provider: T } & CoverageIstanbulOptions) :
T extends 'v8' ? ({ provider: T } & CoverageV8Options) :
T extends 'v8' ? ({
/**
* Provider to use for coverage collection.
*
* @default 'v8'
*/
provider: T
} & CoverageV8Options) :
T extends 'custom' ? ({ provider: T } & CustomProviderOptions) :
({ provider?: T } & (CoverageV8Options))

Expand Down Expand Up @@ -113,13 +120,15 @@ export interface BaseCoverageOptions {

/**
* List of files excluded from coverage as glob patterns
*
* @default ['coverage/**', 'dist/**', '**\/[.]**', 'packages/*\/test?(s)/**', '**\/*.d.ts', '**\/virtual:*', '**\/__x00__*', '**\/\x00*', 'cypress/**', 'test?(s)/**', 'test?(-*).?(c|m)[jt]s?(x)', '**\/*{.,-}{test,spec}.?(c|m)[jt]s?(x)', '**\/__tests__/**', '**\/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*', '**\/vitest.{workspace,projects}.[jt]s?(on)', '**\/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}']
*/
exclude?: string[]

/**
* Whether to include all files, including the untested ones into report
*
* @default false
* @default true
*/
all?: boolean

Expand All @@ -139,6 +148,8 @@ export interface BaseCoverageOptions {

/**
* Directory to write coverage report to
*
* @default './coverage'
*/
reportsDirectory?: string

Expand Down

0 comments on commit 2f755f0

Please sign in to comment.