Skip to content

fix: clear runtime folders once before workers start, not per spec#1121

Merged
wswebcreation merged 4 commits intomainfrom
ws/issue-683-clear-runtime-folder
Feb 24, 2026
Merged

fix: clear runtime folders once before workers start, not per spec#1121
wswebcreation merged 4 commits intomainfrom
ws/issue-683-clear-runtime-folder

Conversation

@wswebcreation
Copy link
Member

@wswebcreation wswebcreation commented Feb 24, 2026

Summary

Fixes #683

Setting clearRuntimeFolder: true was clearing the actual and diff folders after each spec/feature execution instead of once at the start of the test run. This caused only the last spec's visual data to survive when running multiple specs in parallel.

Root cause: The clearing logic lived in the BaseClass constructor, which is called every time WdioImageComparisonService is instantiated — once per worker (i.e., once per spec file). So each new worker would wipe out the results from previously completed workers.

Fix:

  • Removed the clearing from the BaseClass constructor
  • Changed _clearRuntimeFolders() from private to protected
  • Moved the clearing call to VisualLauncher.onPrepare(), which runs exactly once in the main process before any workers are spawned

Refactor — Launcher & Storybook separation:

The VisualLauncher class was previously located at src/storybook/launcher.ts, which was misleading since it serves as the general-purpose service launcher for all modes (not just Storybook). The Storybook-specific logic was interleaved with general launcher concerns.

wswebcreation and others added 2 commits February 24, 2026 18:18
)

Move clearRuntimeFolder logic from BaseClass constructor (runs per worker)
to VisualLauncher.onPrepare (runs once in main process before workers).

Refactor: extract storybook logic from launcher into storybook/hooks.ts
and move the launcher out of the storybook/ directory to make it a
general-purpose service launcher.

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot
Copy link

changeset-bot bot commented Feb 24, 2026

🦋 Changeset detected

Latest commit: 7424078

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@wdio/visual-service Patch
@wdio/image-comparison-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@wswebcreation wswebcreation merged commit 0a19d78 into main Feb 24, 2026
11 checks passed
@wswebcreation wswebcreation deleted the ws/issue-683-clear-runtime-folder branch February 24, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Visual Testing] Setting clearRuntimeFolder to true clears the folder after each feature or spec execution.

1 participant