From d7371eae333b2cc5166061a349c8014c44aff020 Mon Sep 17 00:00:00 2001
From: patak <583075+patak-dev@users.noreply.github.com>
Date: Thu, 9 May 2024 05:40:22 -0700
Subject: [PATCH] feat!: remove watchExclude (#5177)
---
docs/config/index.md | 10 +---------
packages/vitest/src/defaults.ts | 1 -
packages/vitest/src/node/cli/cli-config.ts | 1 -
packages/vitest/src/node/core.ts | 2 --
packages/vitest/src/node/logger.ts | 2 --
packages/vitest/src/node/plugins/index.ts | 3 ---
packages/vitest/src/types/config.ts | 7 -------
7 files changed, 1 insertion(+), 25 deletions(-)
diff --git a/docs/config/index.md b/docs/config/index.md
index 59ab77ca8671..9db22a946cdf 100644
--- a/docs/config/index.md
+++ b/docs/config/index.md
@@ -1036,14 +1036,6 @@ inject('wsPort') === 3000
```
:::
-### watchExclude
-
-- **Type:** `string[]`
-- **Default:** `['**/node_modules/**', '**/dist/**']`
-- **Deprecated** use [`server.watch.ignored`](https://vitejs.dev/config/server-options.html#server-watch)
-
-Glob pattern of file paths to be ignored from triggering watch rerun.
-
### forceRerunTriggers
- **Type**: `string[]`
@@ -1061,7 +1053,7 @@ test('execute a script', async () => {
```
::: tip
-Make sure that your files are not excluded by `watchExclude`.
+Make sure that your files are not excluded by [`server.watch.ignored`](https://vitejs.dev/config/server-options.html#server-watch).
:::
### coverage
diff --git a/packages/vitest/src/defaults.ts b/packages/vitest/src/defaults.ts
index a4fb82f97586..560e6a977a96 100644
--- a/packages/vitest/src/defaults.ts
+++ b/packages/vitest/src/defaults.ts
@@ -76,7 +76,6 @@ const config = {
testTimeout: 5000,
hookTimeout: 10000,
teardownTimeout: 10000,
- watchExclude: ['**/node_modules/**', '**/dist/**'],
forceRerunTriggers: [
'**/package.json/**',
'**/{vitest,vite}.config.*/**',
diff --git a/packages/vitest/src/node/cli/cli-config.ts b/packages/vitest/src/node/cli/cli-config.ts
index 107ba5ae2929..c9c935373e00 100644
--- a/packages/vitest/src/node/cli/cli-config.ts
+++ b/packages/vitest/src/node/cli/cli-config.ts
@@ -615,7 +615,6 @@ export const cliOptionsConfig: VitestCLIOptions = {
snapshotFormat: null,
snapshotSerializers: null,
includeSource: null,
- watchExclude: null,
alias: null,
env: null,
environmentMatchGlobs: null,
diff --git a/packages/vitest/src/node/core.ts b/packages/vitest/src/node/core.ts
index 4e565fa690fb..2149cf6b1890 100644
--- a/packages/vitest/src/node/core.ts
+++ b/packages/vitest/src/node/core.ts
@@ -810,8 +810,6 @@ export class Vitest {
if (this.config.forceRerunTriggers.length)
watcher.add(this.config.forceRerunTriggers)
- watcher.unwatch(this.config.watchExclude)
-
watcher.on('change', onChange)
watcher.on('unlink', onUnlink)
watcher.on('add', onAdd)
diff --git a/packages/vitest/src/node/logger.ts b/packages/vitest/src/node/logger.ts
index de0e32c78b67..61d9d5fed85a 100644
--- a/packages/vitest/src/node/logger.ts
+++ b/packages/vitest/src/node/logger.ts
@@ -135,8 +135,6 @@ export class Logger {
this.console.error(c.dim('typecheck exclude: ') + c.yellow(config.typecheck.exclude.join(comma)))
}
})
- if (config.watchExclude)
- this.console.error(c.dim('watch exclude: ') + c.yellow(config.watchExclude.join(comma)))
if (config.watch && (config.changed || config.related?.length)) {
this.log(`No affected ${config.mode} files found\n`)
diff --git a/packages/vitest/src/node/plugins/index.ts b/packages/vitest/src/node/plugins/index.ts
index 9bb6499d2e26..585349b3f7df 100644
--- a/packages/vitest/src/node/plugins/index.ts
+++ b/packages/vitest/src/node/plugins/index.ts
@@ -80,9 +80,6 @@ export async function VitestPlugin(options: UserConfig = {}, ctx = new Vitest('t
},
server: {
...testConfig.api,
- watch: {
- ignored: testConfig.watchExclude,
- },
open,
hmr: false,
preTransformRequests: false,
diff --git a/packages/vitest/src/types/config.ts b/packages/vitest/src/types/config.ts
index 83365a3d6044..400755654200 100644
--- a/packages/vitest/src/types/config.ts
+++ b/packages/vitest/src/types/config.ts
@@ -443,12 +443,6 @@ export interface InlineConfig {
*/
globalSetup?: string | string[]
- /**
- * Glob pattern of file paths to be ignore from triggering watch rerun
- * @deprecated Use server.watch.ignored instead
- */
- watchExclude?: string[]
-
/**
* Glob patter of file paths that will trigger the whole suite rerun
*
@@ -938,7 +932,6 @@ export type ProjectConfig = Omit<
| 'poolOptions'
| 'teardownTimeout'
| 'silent'
- | 'watchExclude'
| 'forceRerunTriggers'
| 'testNamePattern'
| 'ui'