From 04c175262b7754b6c58699929f75c7381f9dc060 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Fri, 20 Dec 2024 23:28:28 +0100 Subject: [PATCH] Only reset story count on file change when watch mode is enabled --- code/addons/test/src/node/vitest-manager.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/addons/test/src/node/vitest-manager.ts b/code/addons/test/src/node/vitest-manager.ts index 0a5ff8ab0b4e..1e405ea9c344 100644 --- a/code/addons/test/src/node/vitest-manager.ts +++ b/code/addons/test/src/node/vitest-manager.ts @@ -316,13 +316,14 @@ export class VitestManager { const id = slash(file); this.vitest?.logger.clearHighlightCache(id); this.updateLastChanged(id); - this.storyCountForCurrentRun = 0; // when watch mode is disabled, don't trigger any tests (below) // but still invalidate the cache for the changed file, which is handled above if (!this.testManager.config.watchMode) { return; } + + this.storyCountForCurrentRun = 0; await this.runAffectedTests(file); }