Skip to content

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

@justinmc

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues 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.good first issueRelatively approachable for first-time contributorsteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    Status

    In Progress

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions