flutter/flutter

(Test cross-imports) Don't cross-import test utils

Open

#182.636 aperta il 19 feb 2026

Vedi su GitHub
 (7 commenti) (1 reazione) (0 assegnatari)Dart (30.366 fork)batch import
P1a: testsf: cupertinof: material designframeworkgood first issueteam-frameworktriaged-framework

Metriche repository

Star
 (176.322 star)
Metriche merge PR
 (Merge medio 7g 7h) (491 PR mergiate in 30 g)

Descrizione

Some test files import test utilities from other library's tests. This won't be possible once Material and Cupertino are moved to the flutter/packages repo.

For example:

https://github.com/flutter/flutter/blob/935b8f70305b2d82d76b2a15d568d973e2835895/packages/flutter/test/material/scaffold_test.dart#L15

Umbrella issue: https://github.com/flutter/flutter/issues/177028

What to do about it

  • Move the util to flutter_test if:
    • it's used in many places.
    • it has a solid API that has been in use for awhile and we are ready to commit to it.
    • it's of public-level quality.
  • Duplicate the util if:
    • its implementation is trivial, or it's just a constant, etc.
    • we are worried about its API needing changes and don't want to make it public.
  • Any other options? I don't think it will be possible to import it any other way.

The utils

Rendering:

Widgets:

Tests to fix:

Material importing Widgets

$ rg "import '\.\.\/widgets" packages/flutter/test/material -l

Cupertino importing Widgets

$ rg "import '\.\.\/widgets" packages/flutter/test/cupertino -l

Cupertino importing Rendering

$ rg "import '\.\.\/rendering" packages/flutter/test/cupertino -l

Guida contributor