Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to display tests in Test Explorer 0.7.4 and VSCode 1.51 #288

Closed
adamvlasak opened this issue Nov 13, 2020 · 15 comments
Closed

Unable to display tests in Test Explorer 0.7.4 and VSCode 1.51 #288

adamvlasak opened this issue Nov 13, 2020 · 15 comments

Comments

@adamvlasak
Copy link

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.

@danarcher
Copy link

danarcher commented 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.

@stefanforsberg
Copy link
Collaborator

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

@ManfredLange
Copy link

ManfredLange commented Nov 20, 2020

Unfortunately the quick fix by @danarcher doesn't appear to work when using a docker container as dev container. In that case VS Code installs the extension into the container, if needed grabs it from some cache and as a result overwrites the manual change.

A proper fix would be extremely helpful. No workaround is available at the moment for dev containers.

Update: It is possible to get the quick fix working as follows:

  1. Start dev container with "Remote Container: Open in container", this builds the dev container
  2. Apply quick fix in ~/.vscode-server/extensions/formulahendry.dotnet-test-explorer-0.7.4/out/src/ (Note that this is in folder vscode-server!)
  3. Reopen repository with "Remote Container: Open locally"
  4. Now you can reopen with "Remote Container: Open in container". It looks as if reopening is needed to reload the extension, this time including the quick fix

If at any time you choose "Remote Container: Rebuild container", you need to reapply the quick fix, i.e. you need to go through the steps mentioned in this comment.

@stefanforsberg
Copy link
Collaborator

@danarcher @adamvlasak @ManfredLange Hey, just wanted to confirm that you guys are running nunit or mstest right?

@stefanforsberg
Copy link
Collaborator

I've pushed a change included in 0.7.5 that hopefully fixes the problems you're having. As soon as @formulahendry is able to push the new version to the market place it should be available to you.

@danarcher
Copy link

@stefanforsberg Hey Stefan, yes mstest here on this occasion, and thanks

@adamvlasak
Copy link
Author

We use NUnit 3.x

@ManfredLange
Copy link

@stefanforsberg NUnit here as well.

Thank you so much for the quick turn-around. Now I'm just waiting for the new version to be published. :-)

@stefanforsberg
Copy link
Collaborator

Sorry guys for the long wait, @formulahendry is not responding (might be on holiday or something) and I don't have a way of pushing a new release myself.

@ManfredLange
Copy link

@formulahendry It would be great if you could identify a second person who was able to push a new release while you're absent or too busy to look after this. We all have full calendars, so we all understand this is not always possible. Given this extension has been downloaded over 250,000 times and since more people are moving to .NET 5.0 it's just a matter of time that more and more people are affected by this problem. Therefore being able to publish new releases even if you are too busy would be great. Just a thought. :-)

@adamvlasak
Copy link
Author

Hello, are there any news about release to market, please? I agree with identifying second person to perform releases. It can help you. Take care!

@janaka
Copy link
Collaborator

janaka commented Jan 17, 2021

@adamvlasak I'm not sure of the latest state. Waiting to hear back from Stefan. But I also ping'd @formulahendry. Hopefully we can get this released soon.

Agree, another person with ability to release would be good.

@janaka
Copy link
Collaborator

janaka commented Jan 18, 2021

@adamvlasak v0.7.5 has been released. Can you please let us know if it fixes the issue.

@adamvlasak
Copy link
Author

Hello, I can confirm tests started appearing. Thanks!

But I noticed we have lost ability to display methods from multiple assemblies within a tree. I checked settings of this extension and there is one:

image

It looks like every option will display as flat results now. This causes VSCode to be confused about symbols when I want to navigate by clicking on the test name.

Do you want me to report new issue?

@janaka
Copy link
Collaborator

janaka commented Jan 19, 2021

Yes, a new issue is probably cleaner.

@janaka janaka closed this as completed Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants