Skip to content

Test gutter icons appear in wrong lines #4586

Closed

Description

@Snonky

Describe the bug
The gutter icons in test files appear in the wrong lines. This also affects the in-line stack trace boxes that pop up when a test fails.

To Reproduce
Steps to reproduce the behavior:

  1. create a fresh flutter project with the cli: flutter create new_project
  2. open VSCode and open the new_project folder
  3. Go to test/widget_test.dart
  4. Make a change to make the test fail (e.g. change the '0' to '1' in line 19)
  5. Run the test (by clicking on the inline run button)

Expected behavior
The gutter icon of the test should be at line 14 where the test is defined. The test's failure stack trace should also appear there.

Actual behavior
Instead the gutter icon is at line 31. It is consistent across VSCode and OS restarts,

Screenshots

grafik

grafik

This issue started happening to me since about 3 days ago. Regrettably I can't pin point it to updating something that might have broken it. I hope somebody who has a setup like mine can replicate it

Please complete the following information:

  • Operating System and version: Windows 10 Home, version 22H2, build 19045.2965
  • VS Code version: 1.79.1
  • Dart extension version: 3.66.0
  • Dart/Flutter SDK version: 3.0.2/3.10.2

Activity

  1. DanTup commented on Jun 14, 2023

    @DanTup
    Member

    Could you try capturing debugging logs while reproducing this?

    • Run the Dart: Capture Debugging Logs command
    • Run the test from your sample project (the one in the screenshot so I can see what the line numbers should be)
    • Click Cancel on the logging notification to stop logging and open the log
    • Remove anything sensitive from the log
    • Attach the log here, in a gist, or email to me at [email protected].

    Thanks!

  2. added
    awaiting infoRequires more information from the customer to progress
    on Jun 14, 2023
  3. Snonky commented on Jun 14, 2023

    @Snonky
    Author

    Here is the gist along with a video of my editor while the log was created.

    Video
    dart-code_blurred.mp4
  4. DanTup commented on Jun 15, 2023

    @DanTup
    Member

    Thanks for the log - it seems the JSON when running your test is not providing all of the data. When it works for me, I have a payload like:

    {
    	"test": {
    		"id": 3,
    		"name": "Counter increments smoke test",
    		"line": 160,
    		"column": 5,
    		"url": "package:flutter_test/src/widget_tester.dart",
    		"root_line": 14,
    		"root_column": 3,
    		"root_url": "file:///Users/danny/Desktop/dart_samples/dartcode_4586/test/widget_test.dart"
    	},
    	"type": "testStart"
    }

    The root_... fields are the important ones.

    In your log, it looks like this:

    {
    	"test": {
    		"id": 3,
    		"name": "Counter increments smoke test",
    		"line": 153,
    		"column": 5,
    		"url": "package:flutter_test/src/widget_tester.dart"
    	},
    	"type": "testStart"
    }

    We currently blindly assume if there's not root_ values, then the standard values are usable, but here not what we want (and we're trying to put the marker on line 153).

    This might be Windows-specific, so I'll try on there shortly and investigate further.

  5. added
    in debuggingRelates to the debug adapter or process of running debug sessions
    in testingRelates to test execution of Dart/Flutter tests for end users
    and removed
    awaiting infoRequires more information from the customer to progress
    on Jun 15, 2023
  6. DanTup commented on Jun 15, 2023

    @DanTup
    Member

    Confirmed I can repro this on Windows. Opened dart-lang/test#2037.

  7. Snonky commented on Jun 15, 2023

    @Snonky
    Author

    We currently blindly assume if there's not root_ values, then the standard values are usable, but here not what we want (and we're trying to put the marker on line 153).

    Can confirm, when I artificially lengthen the test tfile to >153 lines the gutter icon jumps to line 153.

  8. DanTup commented on Jul 11, 2023

    @DanTup
    Member

    This was fixed via dart-lang/test#2037. I think Flutter pins the version of the test package so the fix will show up in a future release. For Dart, you should be able to update to the latest version of test yourself.

  9. added
    relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
    on Jul 11, 2023
  10. added this to the v3.70.0 milestone on Jul 11, 2023
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

    in debuggingRelates to the debug adapter or process of running debug sessionsin testingRelates to test execution of Dart/Flutter tests for end usersis bugon windowsrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions