Skip to content

(Test cross-imports) Tests should go in the library that they're testing #177414

Open

Description

@justinmc

Umbrella issue: #177028
Design doc: https://docs.google.com/document/d/1UHxALQqCbmgjnM1RNV9xE2pK3IGyx-UktGX1D7hYCjs/edit?tab=t.0

Tests should be located in the library whose code they are testing. If a tests needs to test multiple libraries (say, a platform adaptive constructor), then put it in Material. This will help with our general test organization and also help remove a devDependency after Material and Cupertino are decoupled from the framework.

How to fix

  1. Find a test listed below that is not already fixed (checked) and that does not have a PR already linked.
  2. Look at the test that references Material/Cupertino and double check whether it would be possible to migrate the test to remove the dependency. I may have made a mistake including it in this issue (maybe it should be in (Test cross-imports) Don't import Material in tests for convenience #177415 instead).
  3. If I was wrong and the test doesn't need Material/Cupertino, refactor it to remove the dependency instead of moving the test! Otherwise, for any test that is fundamentally is about testing Material/Cupertino, copy it out of its current file and into test/material or test/cupertino.
  4. Ensure that all such tests have been removed from the file, and then delete the Material/Cupertino import.
  5. If there are no tests left in the file, delete the file altogether.
  6. In your PR, reference this issue as "Part of" instead of "Fixes", to avoid it being prematurely closed.

Tests to fix

Located in Widgets, imported Material

Located in Cupertino, imported Material

Located in Widgets, imported Cupertino

Activity

  1. added
    in triagePresently being triaged by the triage team
    a: tests"flutter test", flutter_test, or one of our tests
    frameworkflutter/packages/flutter repository. See also f: labels.
    c: proposalA detailed proposal for a change to Flutter
    and removed
    in triagePresently being triaged by the triage team
    on Oct 23, 2025
  2. self-assigned this
    on Oct 28, 2025
  3. added
    P1High-priority issues at the top of the work list
    on Oct 28, 2025
  4. moved this to In Progress in Decoupling Designon Nov 5, 2025
  5. justinmc commented on Jan 2, 2026

    @justinmc
    ContributorAuthor

    These are up for contributions now that #177029 and #178693 have merged, in case anyone wants to help migrate these! Unassigning myself.

  6. removed their assignment
    on Jan 2, 2026
  7. 46 remaining items

  8. QuncCccccc commented on Jun 24, 2026

    @QuncCccccc
    Contributor

    Seems all files in "Located in Cupertino, imported Material" section has removed material imports in 5b1c84c. Should we check these checkboxes?

  9. flutter-triage-bot commented on Oct 28, 2026

    @flutter-triage-bot

    This issue is marked P1 but has had no recent status updates.

    The P1 label indicates high-priority issues that are at the top of the work list. This is the highest priority level a bug can have if it isn't affecting a top-tier customer or breaking the build. Bugs marked P1 are generally actively being worked on unless the assignee is dealing with a P0 bug (or another P1 bug). Issues at this level should be resolved in a matter of months and should have monthly updates on GitHub.

    Please consider where this bug really falls in our current priorities, and label it or assign it accordingly. This allows people to have a clearer picture of what work is actually planned. Thanks!

  10. added
    P2Important issues not at the top of the work list
    and removed
    P1High-priority issues at the top of the work list
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our testsc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework teamwaiting for PR to land (fixed)A fix is in flight

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions