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 path/to/my.sln returns exit code 1 when all tests pass if an unrelated project in the solution has a build error #5196

Closed
chrisfcarroll opened this issue Aug 30, 2024 · 1 comment

Comments

@chrisfcarroll
Copy link

chrisfcarroll commented Aug 30, 2024

Description

dotnet test $(solution) fails even though all tests pass, if the solution includes a project that fails to build.

Steps to reproduce

  • Create a solution with a test project with a passing test.
  • Add a project to the solution that doesn't build on your machine (for instance, set the TargetFramework to something you don't have)
  • run dotnet test

Expected behavior

All tests pass, and all the projects that the tests depending on built, so the exit code should be 0

Actual behavior

All the filtered tests pass, but dotnet returns exit code 1 because of the unrelated build error.

Diagnostic logs

Environment

.NET SDK:
Version: 8.0.400
Commit: 36fe6dda56
Workload version: 8.0.400-manifests.56cd0383
MSBuild version: 17.11.3+0c8610977

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.400\

@chrisfcarroll chrisfcarroll changed the title dotnet test path/to/my.sln returns exit code 1 when all tests pass, if --testfilter excludes all tests in 1 or more dlls dotnet test path/to/my.sln returns exit code 1 when all tests pass, if a --testfilter excludes all tests in one project Aug 30, 2024
@chrisfcarroll chrisfcarroll changed the title dotnet test path/to/my.sln returns exit code 1 when all tests pass, if a --testfilter excludes all tests in one project dotnet test path/to/my.sln returns exit code 1 when all tests pass if an unrelated project in the solution has a build error Aug 30, 2024
@chrisfcarroll
Copy link
Author

otoh, not entirely black and white that this counts as a bug.

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

1 participant