Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit ea85555

Browse files
author
Peter Huene
committed
Add verbosity option to run command.
This commit adds the verbosity option to the run command. This will be used in tests for visibility into what the run command is doing. The default verbosity is unaffected. Fixes issue #7932.
1 parent 40b0e0f commit ea85555

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/dotnet/commands/dotnet-run/RunCommandParser.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ public static Command Run() =>
5151
"--no-build",
5252
LocalizableStrings.CommandOptionNoBuildDescription,
5353
Accept.NoArguments()),
54-
CommonOptions.NoRestoreOption()
54+
CommonOptions.NoRestoreOption(),
55+
CommonOptions.VerbosityOption()
5556
});
5657
}
5758
}

test/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,5 +518,27 @@ public void ItPrintsAnErrorWhenLaunchSettingsAreCorrupted()
518518
.And.HaveStdOutContaining("(NO MESSAGE)")
519519
.And.HaveStdErrContaining(string.Format(LocalizableStrings.RunCommandExceptionCouldNotApplyLaunchSettings, LocalizableStrings.DefaultLaunchProfileDisplayName, "").Trim());
520520
}
521+
522+
[Fact]
523+
public void ItRunsWithTheSpecifiedVerbosity()
524+
{
525+
var testAppName = "MSBuildTestApp";
526+
var testInstance = TestAssets.Get(testAppName)
527+
.CreateInstance()
528+
.WithSourceFiles();
529+
530+
var result = new RunCommand()
531+
.WithWorkingDirectory( testInstance.Root.FullName)
532+
.ExecuteWithCapturedOutput("-v:n");
533+
534+
result.Should().Pass()
535+
.And.HaveStdOutContaining("Hello World!");
536+
537+
if (!DotnetUnderTest.IsLocalized())
538+
{
539+
result.Should().HaveStdOutContaining("Restore")
540+
.And.HaveStdOutContaining("CoreCompile");
541+
}
542+
}
521543
}
522544
}

0 commit comments

Comments
 (0)