Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -686,11 +686,15 @@ Update snapshot files. This will update all changed snapshots and delete obsolet
### watch<NonProjectOption />

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

Enable watch mode

In interactive environments, this is the default, unless `--run` is specified explicitly.

In CI, or when run from a non-interactive shell, "watch" mode is not the default, but can be enabled explicitly with this flag.

### root

- **Type:** `string`
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ outline: deep

### `vitest`

Start Vitest in the current directory. Will enter the watch mode in development environment and run mode in CI automatically.
Start Vitest in the current directory. Will enter the watch mode in development environment and run mode in CI (or non-interactive terminal) automatically.

You can pass an additional argument as the filter of the test files to run. For example:

Expand Down Expand Up @@ -50,7 +50,7 @@ Perform a single run without watch mode.

### `vitest watch`

Run all test suites but watch for changes and rerun tests when they change. Same as calling `vitest` without an argument. Will fallback to `vitest run` in CI.
Run all test suites but watch for changes and rerun tests when they change. Same as calling `vitest` without an argument. Will fallback to `vitest run` in CI or when stdin is not a TTY (non-interactive environment).

### `vitest dev`

Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const configDefaults: Readonly<{
}> = Object.freeze({
allowOnly: !isCI,
isolate: true,
watch: !isCI,
watch: !isCI && process.stdin.isTTY,
globals: false,
environment: 'node' as const,
pool: 'forks' as const,
Expand Down
Loading