diff --git a/docs/config/index.md b/docs/config/index.md index 18ebf912a88a..8cab3438543a 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -521,7 +521,7 @@ Update snapshot files. This will update all changed snapshots and delete obsolet ### watch - **Type:** `boolean` -- **Default:** `true` +- **Default:** `!process.env.CI` - **CLI:** `-w`, `--watch`, `--watch=false` Enable watch mode @@ -1397,7 +1397,7 @@ test('doNotRun', () => { ### open - **Type:** `boolean` -- **Default:** `false` +- **Default:** `!process.env.CI` - **CLI:** `--open`, `--open=false` Open Vitest UI (WIP) @@ -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. diff --git a/packages/vitest/src/types/benchmark.ts b/packages/vitest/src/types/benchmark.ts index df4fc1d79876..addb0bc71b60 100644 --- a/packages/vitest/src/types/benchmark.ts +++ b/packages/vitest/src/types/benchmark.ts @@ -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[] @@ -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 diff --git a/packages/vitest/src/types/config.ts b/packages/vitest/src/types/config.ts index ec674dfb3f7a..b8db4b5e5d49 100644 --- a/packages/vitest/src/types/config.ts +++ b/packages/vitest/src/types/config.ts @@ -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[] @@ -359,7 +359,7 @@ export interface InlineConfig { /** * Watch mode * - * @default true + * @default !process.env.CI */ watch?: boolean @@ -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] | ReporterWithOptions)[] @@ -439,7 +441,7 @@ export interface InlineConfig { * * Useful if you are testing calling CLI commands * - * @default [] + * @default ['**\/package.json/**', '**\/{vitest,vite}.config.*\/**'] */ forceRerunTriggers?: string[] @@ -494,6 +496,8 @@ export interface InlineConfig { /** * Enable Vitest UI + * + * @default false */ ui?: boolean @@ -508,7 +512,7 @@ export interface InlineConfig { /** * Open UI automatically. * - * @default true + * @default !process.env.CI */ open?: boolean @@ -551,6 +555,8 @@ export interface InlineConfig { /** * Allow tests and suites that are marked as only + * + * @default !process.env.CI */ allowOnly?: boolean @@ -626,6 +632,8 @@ export interface InlineConfig { /** * Ignore any unhandled errors that occur + * + * @default false */ dangerouslyIgnoreUnhandledErrors?: boolean @@ -708,14 +716,20 @@ export interface TypecheckConfig { only?: boolean /** * What tools to use for type checking. + * + * @default 'tsc' */ checker: 'tsc' | 'vue-tsc' | (string & Record) /** * 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[] /** diff --git a/packages/vitest/src/types/coverage.ts b/packages/vitest/src/types/coverage.ts index 4d10f51ff484..69425c9d7195 100644 --- a/packages/vitest/src/types/coverage.ts +++ b/packages/vitest/src/types/coverage.ts @@ -65,7 +65,14 @@ type Provider = 'v8' | 'istanbul' | 'custom' | undefined export type CoverageOptions = 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)) @@ -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 @@ -139,6 +148,8 @@ export interface BaseCoverageOptions { /** * Directory to write coverage report to + * + * @default './coverage' */ reportsDirectory?: string