Skip to content

Line info for test_reflective_loader package tests can easily get out of sync #5544

Closed

Description

@FMorschel

From #5529 (comment):

And the current UI, although it does work most of the time, if you add some lines, I've seen them get out of sync (interestingly, the "expect" error labels that show up never do, they're always in the right place) from the method declaration.

I don't know how often this happens, but I'd be interested in an issue for this - because if this happens with those markers, it would also happen to the CodeLens if we switched them over to using the test model data 😔

  1. In Dart SDK, open pkg\analysis_server\test\services\completion\dart\location\dart_doc_test.dart and run all tests.
  2. Add a new line before the first test inside the reflective test class (and wait just a small bit), see that all current checks stay in place while the new line is added:

Image

But interestingly, if you add a new character to any of the assertResponse texts, before the first step, so the output is different:

Image

This is the result. The expected value shows up after the method opening, and the icon to show the test error stays on the line above.

Activity

  1. DanTup commented on Jun 11, 2025

    @DanTup
    Member

    Thanks - I can reproduce this.

    I think what's happening here is that VS Code is correctly tracking that the test marker needs moving when you edit the file, but the modification triggers new outline data from the server, which results in us "rebuilding" the test model.. and when we do that, we tell VS Code again that this test is on line 17, even though it is not anymore.

    I think we need to ensure we never update the location of an existing test in the tree if its location was not from an outline node.

  2. added this to the v3.114.0 milestone on Jun 11, 2025
  3. added
    in testingRelates to test execution of Dart/Flutter tests for end users
    on Jun 11, 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

    in testingRelates to test execution of Dart/Flutter tests for end usersis bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions