Skip to content

flutter_test has src imports on packages test_api and matcher #185016

Open

Description

@sigurdm

This is unsound in general, and makes it impossible to unpin these packages as part of #158050

Examples:

import 'package:test_api/src/backend/declarer.dart'; // ignore: implementation_imports

import 'package:matcher/src/expect/async_matcher.dart'; // ignore: implementation_imports

One possibility is to expose all the depended upon code in the public api.

Activity

  1. saurabh-mirajkar commented on Apr 14, 2026

    @saurabh-mirajkar
    Contributor

    @sigurdm Thanks for the detailed report. As the issue is related to flutter_test, which is a first-party package in the Flutter repo, labeling this under team-ecosystem for further triage.

  2. added
    a: tests"flutter test", flutter_test, or one of our tests
    and removed
    in triagePresently being triaged by the triage team
    on Apr 14, 2026
  3. stuartmorgan-g commented on Apr 14, 2026

    @stuartmorgan-g
    Contributor

    I believe flutter_test is team-framework, but please redirect if I'm mistaken.

  4. added
    P1High-priority issues at the top of the work list
    on Apr 14, 2026
  5. Piinks commented on Apr 14, 2026

    @Piinks
    Contributor

    Taking a look!

  6. Piinks commented on Apr 14, 2026

    @Piinks
    Contributor

    It looks like to resolve this

    • package:matcher will need to :
      • Expose AsyncMatcher in the public API (e.g., in package:matcher/expect.dart or package:matcher/matcher.dart).
    • package:test_api will need to:
      • Expose the following backend classes in package:test_api/backend.dart:
        • Declarer
        • Group
        • GroupEntry
        • Invoker
        • LiveTest
        • Message
        • State
        • Test

    The matcher and test_api packages are owned by the dart team, is exposing these classes something that can be done?

  7. stuartmorgan-g commented on Apr 15, 2026

    @stuartmorgan-g
    Contributor

    /cc @jakemac53 and @natebosch who had weighed in on the comment thread about this in the unpinning doc.

  8. jakemac53 commented on Apr 27, 2026

    @jakemac53
    Contributor

    Technically it's something that can be done, and if flutter is anyways using them there isn't much of a philosophical difference.

    We could expose these only through test_api and not test_core or test, which would alleviate some of the concerns around breakage (breaking versions of test_api are less concerning).

  9. jakemac53 commented on Apr 27, 2026

    @jakemac53
    Contributor

    Probably the largest question mark would be around AsyncMatcher in matcher.

  10. jakemac53 commented on Apr 27, 2026

    @jakemac53
    Contributor

    Sent out dart-lang/test#2635 - but no promises it will land :D

  11. flutter-triage-bot commented on Sep 1, 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!

  12. jakemac53 commented on Sep 2, 2026

    @jakemac53
    Contributor

    I can work on a PR for the test_api bits

  13. jakemac53 commented on Sep 2, 2026

    @jakemac53
    Contributor

    Looks like there are many packages that will end up having to be upgraded, and using the update packages tool did not actually update test_api and friends, so I am not sure how to proceed here.

    There is some issue due to test/analyzer/archive interactions, archive is pinned and causing some issues. I will see if I can work my way out of this mess but I am going to timebox it.

  14. self-assigned this
    on Sep 2, 2026
  15. jakemac53 commented on Sep 2, 2026

    @jakemac53
    Contributor

    Note that either some were missed or some have been added, but there are additional types now that will need to be exposed by test_api as well. But we can get rid of some of the src imports still, and I can send an additional PR to expose the missing ones.

  16. removed their assignment
    on Sep 2, 2026
  17. jakemac53 commented on Sep 2, 2026

    @jakemac53
    Contributor

    So I realized that this will also have to be coordinated with google3... and yeah I don't think I can take that on.

    I will send a PR to test_api for the additional APIs to expose.

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

    P1High-priority issues at the top of the work lista: tests"flutter test", flutter_test, or one of our testsdependency: dartDart team may need to help usteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions