Skip to content

Commit

Permalink
Merge pull request #30121 from storybookjs/test-count-reset-fix
Browse files Browse the repository at this point in the history
Addon Test: Only reset story count on file change when watch mode is enabled
  • Loading branch information
yannbf authored Dec 23, 2024
2 parents 00384d6 + 7faee6d commit e44bae7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion code/addons/test/src/node/vitest-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit e44bae7

Please sign in to comment.