Fix dotnet run tests for launch settings stderr change#53908
Fix dotnet run tests for launch settings stderr change#53908jaredpar wants to merge 1 commit intodotnet:mainfrom
Conversation
Commit 1ebcc5e correctly moved the 'Using launch settings from...' message from stdout to stderr (fixing dotnet#45640), but only updated the dotnet test tests. The dotnet run tests still asserted empty stderr and checked stdout for the message, causing 10 tests to fail across all platforms in every CI build. Update the dotnet run test assertions to match the new behavior: - Tests using launch profiles now expect the message on stderr instead of asserting stderr is empty - ItPrintsUsingLaunchSettingsMessageWhenNotQuiet checks stderr instead of stdout for the message - Tests using --no-launch-profile or --verbosity quiet correctly continue to assert empty stderr Fixes dotnet#53879 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates dotnet run test expectations to align with the recent behavior change that prints the “Using launch settings from …” message to stderr (instead of stdout), fixing CI failures after the change made for #45640.
Changes:
- Update
dotnet runtests to expect the launch settings banner on stderr when launch profiles are used. - Switch “not quiet” banner assertions to check stderr rather than stdout.
- Keep assertions that stderr is empty for scenarios like
--verbosity quiet/--no-launch-profile.
Show a summary per file
| File | Description |
|---|---|
| test/dotnet.Tests/CommandTests/Run/RunCommandTests.cs | Adjusts stderr expectations for launch settings usage in environment variable expansion test. |
| test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsVbProj.cs | Updates VB project run tests to assert the launch settings message appears on stderr. |
| test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsCsProj.cs | Updates C# project run tests to assert the launch settings message appears on stderr and moves the “not quiet” check accordingly. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 1
| cmd.Should().Pass() | ||
| .And.NotHaveStdOutContaining(string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath)) | ||
| .And.HaveStdOutContaining("First"); | ||
|
|
||
| cmd.StdErr.Should().BeEmpty(); | ||
| cmd.StdErr.Should().Contain("Using launch settings from"); |
There was a problem hiding this comment.
In ItDefaultsToTheFirstUsableLaunchProfile, the NotHaveStdOutContaining(string.Format(..., launchSettingsPath)) check is likely ineffective because VbAppWithLaunchSettings has launchSettings.json under My Project (not Properties). Consider updating the expected path (or asserting only on the stable prefix) so this test actually verifies the launch settings message is not written to stdout.
|
I think there's overlap with @MichaelSimons's PR over in #53905 here. |
|
If he's working on it then I'll defer to him. Was just going through my Copilot triage tool, and it had a ready fix for this I wanted to try |
Commit 1ebcc5e correctly moved the 'Using launch settings from...' message from stdout to stderr (fixing #45640), but only updated the dotnet test tests. The dotnet run tests still asserted empty stderr and checked stdout for the message, causing 10 tests to fail across all platforms in every CI build.
Update the dotnet run test assertions to match the new behavior:
Fixes #53879