From e40f9924751b69dbad868ae318d8be7289071ca7 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Mon, 22 Apr 2024 10:48:06 +0200 Subject: [PATCH] fix(vitest): watch the output directory correctly (#5584) --- 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 c0b1d9b237b0..5f074491e4e3 100644 --- a/packages/vitest/src/node/plugins/index.ts +++ b/packages/vitest/src/node/plugins/index.ts @@ -90,6 +90,15 @@ export async function VitestPlugin(options: UserConfig = {}, ctx = new Vitest('t allow: resolveFsAllow(getRoot(), testConfig.config), }, }, + build: { + // Vitest doesn't use outputDir, but this value affects what folders are watched + // https://github.com/vitest-dev/vitest/issues/5429 + // This works for Vite <5.2.10 + outDir: 'dummy-non-existing-folder', + // This works for Vite >=5.2.10 + // https://github.com/vitejs/vite/pull/16453 + emptyOutDir: false, + }, test: { poolOptions: { threads: {