From 0a31e85ca7f82b173a7995d61b58552bf18a28f9 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Mon, 16 Jan 2023 13:56:29 +0100 Subject: [PATCH] fix: don't start watching files in "run" mode (#2680) --- packages/vitest/src/node/plugins/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/vitest/src/node/plugins/index.ts b/packages/vitest/src/node/plugins/index.ts index 485e6be506a5..1e6bd5f97690 100644 --- a/packages/vitest/src/node/plugins/index.ts +++ b/packages/vitest/src/node/plugins/index.ts @@ -172,6 +172,15 @@ export async function VitestPlugin(options: UserConfig = {}, ctx = new Vitest('t for (const name in envs) process.env[name] ??= envs[name] + + // don't watch files in run mode + if (!options.watch) { + viteConfig.server.watch = { + persistent: false, + depth: 0, + ignored: ['**/*'], + } + } }, async configureServer(server) { try {