dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.4k stars 10k forks source link

`dotnet watch test` doesn't appear to run the tests and restarts multiple times without file changes on Mac M1 #50441

Closed joeyguerra closed 11 months ago

joeyguerra commented 1 year ago

Is there an existing issue for this?

Describe the bug

Given I'm running dotnet --version = 8.0.100-preview.7.23376.3 and on a Mac Ventura 13.5.1 (22G90), M1 Mini and I create a new XUnit test project (dotnet new xunit -o Temp.Tests) and add Assert.Fail("failed"); to the UnitTest1.cs Test1 method When I run dotnet watch test --project Temp.Tests Then I see

➜  temp dotnet watch test --project Temp.Tests
dotnet watch πŸ”₯ Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload.
  πŸ’‘ Press "Ctrl + R" to restart.
dotnet watch πŸ”§ Building...
  Determining projects to restore...
  All projects are up-to-date for restore.
/usr/local/share/dotnet/sdk/8.0.100-preview.7.23376.3/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.RuntimeIdentifierInference.targets(314,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy [/Users/**/src/**/temp/Temp.Tests/Temp.Tests.csproj]
  Temp.Tests -> /Users/**/src/**/temp/Temp.Tests/bin/Debug/net8.0/Temp.Tests.dll
dotnet watch πŸš€ Started
dotnet watch ⌚ Exited
dotnet watch ⏳ Waiting for a file to change before restarting dotnet...

Expected Behavior

I expect to see a message that states the test has failed, something that looks like the following:

➜  temp dotnet test Temp.Tests 
  Determining projects to restore...
  All projects are up-to-date for restore.
/usr/local/share/dotnet/sdk/8.0.100-preview.7.23376.3/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.RuntimeIdentifierInference.targets(314,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy [/Users/**/src/**/temp/Temp.Tests/Temp.Tests.csproj]
  Temp.Tests -> /Users/**/src/**/temp/Temp.Tests/bin/Debug/net8.0/Temp.Tests.dll
Test run for /Users/**/src/**/temp/Temp.Tests/bin/Debug/net8.0/Temp.Tests.dll (.NETCoreApp,Version=v8.0)
Microsoft (R) Test Execution Command Line Tool Version 17.7.0-preview-23317-01+919ec8358820228cc5fa77ef000051c1d6875399 (arm64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.21]     Temp.Tests.UnitTest1.Test1 [FAIL]
  Failed Temp.Tests.UnitTest1.Test1 [1 ms]
  Error Message:
   Assert.Fail(): failed
  Stack Trace:
     at Temp.Tests.UnitTest1.Test1() in /Users/**/src/**/temp/Temp.Tests/UnitTest1.cs:line 8
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

Failed!  - Failed:     1, Passed:     0, Skipped:     0, Total:     1, Duration: < 1 ms - Temp.Tests.dll (net8.0)
➜  temp

and the process to "wait" to restart when I change the unit tests.

Steps To Reproduce

repo

dotnet --version
# 8.0.100-preview.7.23376.3

dotnet watch test --project Temp.Tests

Exceptions (if any)

No response

.NET Version

8.0.100-preview.7.23376.3

Anything else?

VS Code.

.NET SDK: Version: 8.0.100-preview.7.23376.3 Commit: daebeea8ea

Runtime Environment: OS Name: Mac OS X OS Version: 13.5 OS Platform: Darwin RID: osx.13-arm64 Base Path: /usr/local/share/dotnet/sdk/8.0.100-preview.7.23376.3/

.NET workloads installed: There are no installed workloads to display.

Host: Version: 8.0.0-preview.7.23375.6 Architecture: arm64 Commit: 65b696cf5e RID: osx-arm64

.NET SDKs installed: 7.0.302 [/usr/local/share/dotnet/sdk] 8.0.100-preview.7.23376.3 [/usr/local/share/dotnet/sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.0-preview.7.23375.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.0-preview.7.23375.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found: None

Environment variables: Not set

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

yori-s commented 1 year ago

posted same but in the sdk repo: https://github.com/dotnet/sdk/issues/34949

ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

JohnnyWombwell commented 11 months ago

This has broken my workflow.

How is this considered an enhancement when it has broken a fundamental feature of dotnet watch?

mkArtakMSFT commented 11 months ago

Closing as a dupe of https://github.com/dotnet/sdk/issues/34949