Repository navigation
[flutter_tools] Resolve symlinks and fix flakiness in widget preview tests - #191214
Merged
Merged
Conversation
…tests Resolve symbolic links in `PreviewDetector`'s project root directory and ephemeral directories to ensure consistent path matching. Pass the SDK path to `AnalysisContextCollection` to ensure correct SDK resolution in worktrees. Add a 100ms delay in test helpers before triggering file changes to allow the file watcher to fully initialize. Fixes: flutter#189849
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates PreviewDetector to accept Artifacts and configure the AnalysisContextCollection with the engine Dart SDK path. It also resolves symbolic links for the project root and ephemeral directories using a new helper method, and introduces short delays in tests to allow file watchers to initialize. The feedback suggests caching the resolved ephemeral directory paths during initialization to avoid repeated synchronous file system operations on every file watcher event.
…tector Cache resolved ephemeral directory paths during initialization to avoid repeated synchronous disk I/O on each file watcher event.
srawlins
approved these changes
Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
PreviewDetector's project root directory and ephemeral directories to ensure consistent path matching.AnalysisContextCollectionto ensure correct SDK resolution in worktrees.Related Issues
Fixes #189849
Tests
packages/flutter_tools/test/commands.shard/hermetic/widget_preview/andpackages/flutter_tools/test/commands.shard/permeable/widget_preview/.