Skip to content

Test error hides path to file on Test Results tab #5534

Closed

Description

@FMorschel

Describe the bug
When a test errors, the Test Results tab stops showing the path to the file and that can make sibling-classes tests harder to debug to find which one broke.

To Reproduce
Steps to reproduce the behavior:

  1. Clone https://github.com/FMorschel/test_repro
  2. Run the dart tests

Expected behavior
The path to the file should show up on the Test Results tab even when errors occur.

Screenshots

Image

The same tests in Python (pytest) and JS (jest):

Image

Image

Please complete the following information:

Workspace Environment
Dart Code extension: 3.113.20250602
Flutter extension: 3.113.20250603 (not activated)

App: Visual Studio Code
App Host: desktop
Version: win 1.100.3

Workspace type: Dart (LSP)
Workspace name: test_repro

Dart (3.8.0): C:\Users\felip_0vh5fa6\.puro\shared\caches\18818009497c581ede5d8a3b8b833b81d00cebb7\dart-sdk
Flutter (3.32.0): C:\Users\felip_0vh5fa6\.puro\envs\stable\flutter (No device)

Output from 'dart info'

C:\Users\felip_0vh5fa6\.puro\shared\caches\18818009497c581ede5d8a3b8b833b81d00cebb7\dart-sdk\bin\dart.exe info

If providing this information as part of reporting a bug, please review the information
below to ensure it only contains things you're comfortable posting publicly.

General info

  • Dart 3.8.0 (stable) (Wed May 14 09:07:14 2025 -0700) on "windows_x64"
  • on windows / "Windows 11 Pro" 10.0 (Build 26100)
  • locale is pt-BR

Project info

  • sdk constraint: '^3.8.0'
  • dependencies:
  • dev_dependencies: lints, test

Process info

Memory CPU Elapsed time Command line
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe

Activity

  1. DanTup commented on Jun 5, 2025

    @DanTup
    Member

    Looking at the screenshot again, I think the reason it still shows up for them might be that they are sticking it at the start of the failure message:

    Image

    I'm not sure how to run your Jest test, but I suspect it has similar.

    And while this works, I'm not sure it's a good approach, because it means you wouldn't see the failure message in the error bubble:

    Image

    Or at least, it would be prefixed with the filename/path.

    I feel like it would be better if VS Code provided better options here, or at least a tooltip with the location in so it's not hard to find for failures.

    I wonder if @connor4312 has any thoughts/opinions on this before we file an issue there?

  2. FMorschel commented on Jun 5, 2025

    @FMorschel
    ContributorAuthor

    I'm not sure how to run your Jest test, but I suspect it has similar.

    I used this extension for it https://marketplace.visualstudio.com/items?itemName=Orta.vscode-jest

    I don't code with JS that often, so if there is an official one, I'm unaware. This one worked just fine for me.

    Looking at the screenshot again, I think the reason it still shows up for them might be that they are sticking it at the start of the failure message

    Ohh, I missed that, yes, not ideal.

    What are we sending? I presume we still send the test name with the groups, I presume, for differentiating them, right? Or do they get a different internal ID?

  3. DanTup commented on Jun 5, 2025

    @DanTup
    Member

    What are we sending? I presume we still send the test name with the groups, I presume, for differentiating them, right? Or do they get a different internal ID?

    We create a TestItem to represent the test in the model (these are a tree, with suites at the top level and tests as the leaf nodes), and when a test fails we create a TestMessage with the text for the failure (in the cases where we can extract expected/actual we also supply them).

    It appears that when there is a failure TestMessage then VS Code shows that as the text next to the node, but if there is not, then it appears to show the text from each parent node joined together with a left-pointing arrow (this is useful text to give context of where the test is, but it's not shown for failures).

  4. connor4312 commented on Jun 5, 2025

    @connor4312

    Yea I think we should just fix this in VS Code. Created a draft PR, will merge it after our current release work finishes.

  5. DanTup commented on Jun 5, 2025

    @DanTup
    Member

    @connor4312 perfect, thank you! 🙂

  6. FMorschel commented on Jun 13, 2025

    @FMorschel
    ContributorAuthor

    I see the fix has been merged, and this will get fixed on stable!

    Just as a note to whoever might be interested: this is even more confusing when the error is an assertion/throw and the output starts with a path.

  7. DanTup commented on Jun 16, 2025

    @DanTup
    Member

    I can see this in Insiders now, looks reasonable to me. Thanks @connor4312!

    Image

  8. added this to the v3.114.0 milestone on Jun 16, 2025
  9. added
    in testingRelates to test execution of Dart/Flutter tests for end users
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    and removed on Jun 16, 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

    fixed in vs codein testingRelates to test execution of Dart/Flutter tests for end usersis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions