Skip to content

[flutter_analyzer_plugin] Migrate unit tests off package:test_reflective_loader - #193017

Merged
auto-submit[bot] merged 4 commits into
flutter:masterfrom
kevmoo:remove-analyzer-plugin-mirrors
Sep 21, 2026
Merged

auto-submit[bot] merged 4 commits into
flutter:masterfrom
kevmoo:remove-analyzer-plugin-mirrors

Conversation

@kevmoo

@kevmoo kevmoo commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Removes the test_reflective_loader dev_dependency (and its transitive dart:mirrors dependency) from dev/flutter_analyzer_plugin, migrating all 18 test files to standard package:test test('...', () async { ... }) blocks.

Motivation

  • package:test_reflective_loader relies on dart:mirrors to discover @reflectiveTest classes and invoke test_*() methods at runtime.
  • package:analyzer_testing (AnalysisRuleTest -> PubPackageResolutionTest -> AbstractContextTest) has zero runtime dependency on test_reflective_loader—it only provides setUp() and tearDown() lifecycle hooks.
  • Replacing defineReflectiveTests(...) and class-level test_*() methods with standard setUp / tearDown + test('...', () async { ... }) closures in main():
    • Eliminates test_reflective_loader (and dart:mirrors) from flutter/flutter's dependency tree (pubspec.lock / package_config.json), unblocking Dart 4 dart:mirrors removal.
    • Eliminates all // ignore: unreachable_from_main, non_constant_identifier_names lint suppressions across the test suite.
    • Keeps a 0 net line delta (+524 / -524 lines across 21 files).
    • Allows running dev/flutter_analyzer_plugin tests directly via flutter test dev/flutter_analyzer_plugin (previously blocked because flutter test disables dart:mirrors).

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@kevmoo kevmoo added the CICD Run CI/CD label Sep 18, 2026
@kevmoo
kevmoo marked this pull request as ready for review September 18, 2026 18:43

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request migrates the unit tests in dev/flutter_analyzer_plugin from test_reflective_loader to standard package:test unit tests, updating the documentation and removing the unused dependency. Feedback suggests avoiding the cascade operator ..setUp() in test setups to prevent potential asynchronous safety issues and error masking.

Comment thread dev/flutter_analyzer_plugin/README.md Resolved
@kevmoo
kevmoo requested a review from bkonyi September 18, 2026 18:46
@flutter-dashboard

Copy link
Copy Markdown

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #193017 at sha 31e464f

@flutter-dashboard flutter-dashboard Bot added the will affect goldens Changes to golden files label Sep 18, 2026
bkonyi
bkonyi previously approved these changes Sep 21, 2026
@bkonyi

bkonyi commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Thanks for the cleanup!

@kevmoo kevmoo added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 21, 2026
@kevmoo

kevmoo commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

@bkonyi – sorry. will need another nod from you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants