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

dotnet test do not respect MSBUILDTERMINALLOGGER='auto' env variable. #38654

Closed
tomwolanski opened this issue Feb 9, 2024 · 2 comments
Closed
Labels
Area-DotNet Test untriaged Request triage from a team member

Comments

@tomwolanski
Copy link

Describe the bug

The automatic discovery whenever the new Terminal Logger can be used seems to have different behaviour between dotnet test and dotnet build.

To Reproduce

Create a new .Net 8 project with dotnet new console
Set the logger type to 'auto' $env:MSBUILDTERMINALLOGGER='auto'
Build it with dotnet build
Run tests with dotnet test (should run build as well)

Actual behavour:

When running dotnet build the new logger is used:

> $env:MSBUILDTERMINALLOGGER='auto'                                                                                                                                                                                                                                                                                                                                                                                
> dotnet build
MSBuild version 17.8.3+195e7f5a3 for .NET
Restore complete (0.3s)
   ltbug succeeded (1.2s) → bin\Debug\net8.0\ltbug.dll

Build succeeded in 2.0s

However when running dotnet test the old logger is used:

> $env:MSBUILDTERMINALLOGGER='auto'                                                                                                                                                                                                                                                                                                                                                                               
> dotnet test
Determining projects to restore...
All projects are up-to-date for restore.

The output is different when the new logger is enforced using the on option instead of auto:

> $env:MSBUILDTERMINALLOGGER='on'                                                                                                                                                                                                                                                                                                                                                                               
> dotnet test
Restore complete (0.3s)

Build succeeded in 0.7s

Expected behavour:

Since dotnet build detects that the new Terminal Logger can be used, dotnet test should also correcly detect it and use new logger.
I'd expect to see a new output like on the snippet below:

> $env:MSBUILDTERMINALLOGGER='auto'                                                                                                                                                                                                                                                                                                                                                                               
> dotnet test
Restore complete (0.3s)

Build succeeded in 0.7s

Further technical details

  • Dotnet version: 8.0.101
  • Windows Terminal version: 1.18.10301.0
  • PowerShell Core: 7.4.0
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-DotNet Test untriaged Request triage from a team member labels Feb 9, 2024
@baronfel
Copy link
Member

This is a technical limitation currently, but dotnet/msbuild#9706 should make the test output fully-compatible with terminal logger!

@baronfel
Copy link
Member

This released in preview 2 - please let us know what you think!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-DotNet Test untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

2 participants