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

Make --verbosity case insensitive #2300

Merged
merged 1 commit into from
Jan 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Microsoft.TestPlatform.Build/Tasks/VSTestTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,11 @@ private List<string> AddArgs()
var quietTestLogging = new List<string>() {"q", "quiet"};

string vsTestVerbosity = "minimal";
if (normalTestLogging.Contains(this.VSTestVerbosity))
if (normalTestLogging.Contains(this.VSTestVerbosity.ToLowerInvariant()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were only these 2 affected ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that were the only two case sensitive checks I could find in that file and falsify with tests. There is also

if (!string.IsNullOrEmpty(this.VSTestPlatform) && !this.VSTestPlatform.Contains("AnyCPU"))
but that is unrelated to the issue, and it did not look like it would easily break. We can start another issue if you think this is an improvement that should be made.

{
vsTestVerbosity = "normal";
}
else if (quietTestLogging.Contains(this.VSTestVerbosity))
else if (quietTestLogging.Contains(this.VSTestVerbosity.ToLowerInvariant()))
{
vsTestVerbosity = "quiet";
}
Expand Down
20 changes: 20 additions & 0 deletions test/Microsoft.TestPlatform.Build.UnitTests/VsTestTaskTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,26 @@ public void CreateArgumentShouldSetConsoleLoggerVerbosityToMinimalIfConsoleLogge
Assert.IsNotNull(allArguments.FirstOrDefault(arg => arg.Contains("--logger:Console;Verbosity=minimal")));
}

[TestMethod]
public void CreateArgumentShouldSetConsoleLoggerVerbosityToNormalIfConsoleLoggerIsNotGivenInArgsAndVerbosityIsNormalWithCapitalN()
{
this.vsTestTask.VSTestVerbosity = "Normal";

var allArguments = this.vsTestTask.CreateArgument().ToArray();

Assert.IsNotNull(allArguments.FirstOrDefault(arg => arg.Contains("--logger:Console;Verbosity=normal")));
}

[TestMethod]
public void CreateArgumentShouldSetConsoleLoggerVerbosityToQuietIfConsoleLoggerIsNotGivenInArgsAndVerbosityIsQuietWithCapitalQ()
{
this.vsTestTask.VSTestVerbosity = "Quiet";

var allArguments = this.vsTestTask.CreateArgument().ToArray();

Assert.IsNotNull(allArguments.FirstOrDefault(arg => arg.Contains("--logger:Console;Verbosity=quiet")));
}

[TestMethod]
public void CreateArgumentShouldPreserveWhiteSpaceInLogger()
{
Expand Down