Skip to content

fix: resolve goldens per test file in the optimized bundle - #1830

Draft
Mastersam07 wants to merge 1 commit into
VeryGoodOpenSource:mainfrom
Mastersam07:fix/per-file-golden-comparator
Draft

Mastersam07 wants to merge 1 commit into
VeryGoodOpenSource:mainfrom
Mastersam07:fix/per-file-golden-comparator

Conversation

@Mastersam07

@Mastersam07 Mastersam07 commented Nov 20, 2026 •

Copy link
Copy Markdown

Status

HOLD: waiting for agreement on the approach in #1829.

Description

Closes #1829.

The optimized bundle no longer replaces goldenFileComparator with one global comparator that searches every PNG by name. Each test file's group now gets the LocalFileComparator that flutter test would give that file on its own, so goldens resolve next to it. A comparator the file sets itself is kept, and one set in flutter_test_config.dart that isn't a LocalFileComparator is left as it is.

This fixes comparators that need a LocalFileComparator (such as alchemist with a tolerance), same-named goldens in different folders, and goldens that don't exist yet.

Tested with a new e2e test, per_file_golden_comparator. It has two same-named goldens in different folders, fails on main with Bad state: Too many elements, and passes with this change. I also ran it on a package with 1,065 alchemist goldens, and none of them threw.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

This branch has not been deployed

No deployments
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.

fix: optimized golden tests break comparators that need a LocalFileComparator, and duplicate or new golden names

1 participant