question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to display tests in Test Explorer 0.7.4 and VSCode 1.51

See original GitHub issue

Hi, since VS Code 1.51 I am unable to get Test Explorer displaying tests. I am pretty sure it worked in VS Code 1.50.1.

dotnet --list-sdks

3.1.202 [C:\Program Files\dotnet\sdk]
3.1.301 [C:\Program Files\dotnet\sdk]
3.1.401 [C:\Program Files\dotnet\sdk]
5.0.100 [C:\Program Files\dotnet\sdk]

dotnet --info

.NET SDK (reflecting any global.json):
 Version:   5.0.100
 Commit:    5044b93829

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18363
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.100\

Host (useful for support):
  Version: 5.0.0
  Commit:  cf258a14b7

.NET SDKs installed:
  3.1.202 [C:\Program Files\dotnet\sdk]
  3.1.301 [C:\Program Files\dotnet\sdk]
  3.1.401 [C:\Program Files\dotnet\sdk]
  5.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

Technically dotnet test -t -v=q *.csproj itself lists all relevant tests by running manually using suggested command in the output log of Test Explorer.

However I’ve seen machine running .NET Core 3.1.9 and it has the same problem. It looks like there’s breaking change between versions of VSCode 1.50.1 and 1.51.

Current workaround: downgrade to VSCode 1.50.1.

Thanks for investigating.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:15

github_iconTop GitHub Comments

8reactions
danarchercommented, Nov 16, 2020

I had the same issue, Test Explorer 0.7.4 and VSCode 1.51, in my case with .NET 5. It looks to me like the regex in extractAssemblyPaths() is out of date.

The regex is:

/^Test run for (.+\.dll)\(.+\)/gm

But my .NET 5 output from dotnet test -t -v=q has an additional space:

Test run for C:\...\Project\tests\Project.Tests\bin\Debug\net5.0\Project.Tests.dll (.NETCoreApp,Version=v5.0)
                                                                                  ^ Space

The quick fix for me on Windows was to open %USERPROFILE%\.vscode\extensions\formulahendry.dotnet-test-explorer-0.7.4\out\src\testDiscovery.js and edit the following:

function extractAssemblyPaths(testCommandStdout) {
    const testRunLineRegex = /^Test run for (.+\.dll)\(.+\)/gm;

to:

function extractAssemblyPaths(testCommandStdout) {
    const testRunLineRegex = /^Test run for (.+\.dll)\s*\(.+\)/gm;
                                                     ^^^

to cope with the extra whitespace.

7reactions
stefanforsbergcommented, Nov 18, 2020

Thanks for reporting this. We’ll try and find a regexp that works for both core and .net 5.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Test Explorer is not discovering tests - Visual Studio Feedback
It may be that you are on an early enough version of 16.2 that you still had access to the required extension for...
Read more >
VS Code Test Explorer can't find tests - Stack Overflow
We must test a new feature before pushing it to production. For some reason we can't access our tests with Visual Studio Code...
Read more >
Python Test Explorer VSCode Extension 0.7.1 - Chocolatey
Shows a Test Explorer in the Test view in VS Code's sidebar with all detected tests ... Shows a failed test's log when...
Read more >
Python Test Explorer for Visual Studio Code
Shows a Test Explorer in the Test view in VS Code's sidebar with all detected tests and suites and their state · Convenient...
Read more >
Interactive Unit Testing with .NET Core and VS Code
NET Core Test Explorer. Figure 4 illustrates how to access extensions and, more specifically, how to search for and view the details for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found