Skip to content

"flutter test --platform chrome" does not output the same information as "flutter test" when test fails for not awaiting pump calls #107099

Open

Description

@r-durao-pvotal

When running tests with flutter test --platform chrome, if a test fails, I want to get as much information as possible in order to fix my test.

flutter test --platform chrome should have the same output as flutter test

Steps to Reproduce

  1. Write the following test and run it with flutter test and flutter test --platform chrome
testWidgets('sampleTest', (tester) async {
  tester.pumpWidget(SizedBox());
  expect(find.byType(SizedBox), findsOneWidget);
});
  1. Observe output from both commands

Output from flutter test

The following assertion was thrown running a test:
Guarded function conflict.
You must use "await" with all Future-returning test APIs.
The guarded method "pumpWidget" from class WidgetTester was called from
file:///home/projects/sample/test/widgets/ui/widgets//widget_test.dart
on line 59.
Then, the "expect" function was called from
file:///home/projects/sample/test/widgets/ui/widgets/widget_test.dart
on line 60.
The first method (WidgetTester.pumpWidget) had not yet finished executing at the time that the
second function (expect) was called. Since both are guarded, and the second was not a nested call
inside the first, the first must complete its execution before the second can be called. Typically,
this is achieved by putting an "await" statement in front of the call to the first.
If you are confident that all test APIs are being called using "await", and this expect() call is
not being called at the top level but is itself being called from some sort of callback registered
before the pumpWidget method was called, then consider using expectSync() instead.

Output from flutter test --platform chrome

The following assertion was thrown running a test:
Assertion failed:
file:///home/flutter/3.0.1-stable/packages/flutter_test/lib/src/test_async_utils.dart:311:14
lineMatch != null
is not true

This is far less descriptive and unless I dig into the source code, I won't be able to understand what is going on. And even then I may not be able to understand why the test is failing.

Expected results: output from flutter test --platform chrome should be the same as flutter test's output

Actual results: output from flutter test --platform chrome is not helpful at all for understanding why a test fails under described scenario

Code sample
import 'package:flutter_test/flutter_test.dart';

void main(){
    testWidgets('sampleTest', (tester) async {
      tester.pumpWidget(SizedBox());
      expect(find.byType(SizedBox), findsOneWidget);
    });
}
Details
ricardo@pt-RD-9570:~/$ flutter doctor -v
[✓] Flutter (Channel stable, 3.0.1, on Ubuntu 20.04.4 LTS 5.13.0-51-generic, locale en_US.UTF-8)
    • Flutter version 3.0.1 at /home/ricardo/.pvotal/flutter/3.0.1-stable
    • Upstream repository ssh://[email protected]/flutter/flutter.git
    • Framework revision fb57da5f94 (7 weeks ago), 2022-05-19 15:50:29 -0700
    • Engine revision caaafc5604
    • Dart version 2.17.1
    • DevTools version 2.12.2

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /home/ricardo/Android/Sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1

[✓] Android Studio (version 4.2)
    • Android Studio at /usr/local/android-studio/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+0-b944-P17168821)

[✓] VS Code
    • VS Code at /snap/code/current
    • Flutter extension version 3.44.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 20.04.4 LTS 5.13.0-51-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 102.0.5005.61

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

Activity

  1. added
    in triagePresently being triaged by the triage team
    on Jul 5, 2022
  2. exaby73 commented on Jul 5, 2022

    @exaby73
    Member

    I can reproduce this on stable and master.

    flutter doctor -v (Stable)
    [✓] Flutter (Channel stable, 3.0.4, on macOS 12.4 21F79 darwin-arm, locale en-US)
        • Flutter version 3.0.4 at /Users/nabeelparkar/fvm/versions/stable
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 85684f9300 (5 days ago), 2022-06-30 13:22:47 -0700
        • Engine revision 6ba2af10bb
        • Dart version 2.17.5
        • DevTools version 2.12.2
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4)
        • Android SDK at /Users/nabeelparkar/Library/Android/sdk/
        • Platform android-33, build-tools 33.0.0-rc4
        • ANDROID_SDK_ROOT = /Users/nabeelparkar/Library/Android/sdk/
        • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • CocoaPods version 1.11.3
    
    [✓] Chrome - develop for the web
        • CHROME_EXECUTABLE = /Applications/Brave Browser.app/Contents/MacOS/Brave Browser
    
    [✓] Android Studio (version 2021.2)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2022.1.3)
        • IntelliJ at /Applications/IntelliJ IDEA.app
        • Flutter plugin version 69.0.4
        • Dart plugin version 221.5921.27
    
    [✓] VS Code (version 1.68.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.42.0
    
    [✓] Connected device (2 available)
        • macOS (desktop) • macos  • darwin-arm64   • macOS 12.4 21F79 darwin-arm
        • Chrome (web)    • chrome • web-javascript • Brave Browser 103.1.40.107
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    
    flutter doctor -v (Master)
    [✓] Flutter (Channel master, 3.1.0-0.0.pre.1503, on macOS 12.4 21F79 darwin-arm, locale en-US)
        • Flutter version 3.1.0-0.0.pre.1503 on channel master at /Users/nabeelparkar/fvm/versions/master
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision d7bacf9b3f (4 hours ago), 2022-07-05 05:14:08 -0400
        • Engine revision c49de3fc08
        • Dart version 2.18.0 (build 2.18.0-254.0.dev)
        • DevTools version 2.15.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4)
        • Android SDK at /Users/nabeelparkar/Library/Android/sdk/
        • Platform android-33, build-tools 33.0.0-rc4
        • ANDROID_SDK_ROOT = /Users/nabeelparkar/Library/Android/sdk/
        • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 13F100
        • CocoaPods version 1.11.3
    
    [✓] Chrome - develop for the web
        • CHROME_EXECUTABLE = /Applications/Brave Browser.app/Contents/MacOS/Brave Browser
    
    [✓] Android Studio (version 2021.2)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2022.1.3)
        • IntelliJ at /Applications/IntelliJ IDEA.app
        • Flutter plugin version 69.0.4
        • Dart plugin version 221.5921.27
    
    [✓] VS Code (version 1.68.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.42.0
    
    [✓] Connected device (2 available)
        • macOS (desktop) • macos  • darwin-arm64   • macOS 12.4 21F79 darwin-arm
        • Chrome (web)    • chrome • web-javascript • Brave Browser 103.1.40.107
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    
  3. added
    a: tests"flutter test", flutter_test, or one of our tests
    toolAffects the "flutter" command-line tool. See also t: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    and removed
    in triagePresently being triaged by the triage team
    on Jul 5, 2022
  4. moved this to Good starter bugs/improvements in go/flutter-tools-project (deprecated)on Jul 11, 2022
  5. added
    P3Issues that are less important to the Flutter project
    P2Important issues not at the top of the work list
    and removed
    P3Issues that are less important to the Flutter project
    on Jul 11, 2022
  6. 5 remaining items

  7. added
    fyi-toolFor the attention of Flutter Tool team
    team-webOwned by Web platform team
    and removed
    team-toolOwned by Flutter Tool team
    on Jul 11, 2025
  8. self-assigned this
    on Aug 6, 2025
  9. mdebbar commented on Aug 7, 2025

    @mdebbar
    Contributor

    The lineMatch != null assertion is not being thrown anymore on the web. This is the current output:

    The following assertion was thrown running a test:
    Guarded function conflict.
    You must use "await" with all Future-returning test APIs.
    

    That's still missing the extra details compared to non-web due to differences in stack traces like @jason-simmons explained in his PR: #115500

  10. removed their assignment
    on Aug 7, 2025
  11. added
    P3Issues that are less important to the Flutter project
    triaged-webTriaged by Web platform team
    and removed
    assigned for triageissue is assigned to a domain expert for further triage
    P2Important issues not at the top of the work list
    on Aug 7, 2025
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

    P3Issues that are less important to the Flutter projecta: tests"flutter test", flutter_test, or one of our testsfound in release: 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-webOwned by Web platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-webTriaged by Web platform team

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions