Skip to content

fix: avoid creating empty diff folders when no visual differences exist#1123

Merged
wswebcreation merged 1 commit intomainfrom
ws/fix-issue-879-no-empty-diff-folders
Feb 24, 2026
Merged

fix: avoid creating empty diff folders when no visual differences exist#1123
wswebcreation merged 1 commit intomainfrom
ws/fix-issue-879-no-empty-diff-folders

Conversation

@wswebcreation
Copy link
Member

@wswebcreation wswebcreation commented Feb 24, 2026

Summary

Fixes #879

  • Extract a new getPath helper that resolves folder paths without creating them on disk, separating path computation from directory creation
  • Change prepareComparisonFilePaths to use getPath for the diff folder instead of getAndCreatePath, so the diff directory is only created when saveBase64Image actually writes a diff image
  • Add tests for getPath and prepareComparisonFilePaths to verify that diff folders are not eagerly created

…st (#879)

The diff directory was eagerly created by `prepareComparisonFilePaths`
via `getAndCreatePath` before any comparison took place. This resulted
in empty diff folder trees even when tests passed or baselines were
auto-saved.

Extract a new `getPath` function that resolves the folder path without
calling `mkdirSync`. Use it for the diff folder in
`prepareComparisonFilePaths` so the directory is only created on disk
when `saveBase64Image` actually writes a diff image.

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

changeset-bot bot commented Feb 24, 2026

🦋 Changeset detected

Latest commit: da01583

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

This PR includes changesets to release 2 packages
Name Type
@wdio/image-comparison-core Patch
@wdio/visual-service 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 ce74703 into main Feb 24, 2026
14 checks passed
@wswebcreation wswebcreation deleted the ws/fix-issue-879-no-empty-diff-folders branch February 24, 2026 18:58
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.

empty diff folders created when there is no baselines

1 participant