7ebfdde749
This commit adds the `--verbosity` option to the `install tool` command. MSBuild/NuGet output is now controllable by the user and defaults to being "quiet". This enables users to see warnings from NuGet that otherwise would be swallowed unless NuGet returned a non-zero exit code. As a byproduct of this change, the exception handling and error messages related to obtaining tool packages was retooled. We no longer display `install tool` command line help for installation failures, as it should only be displayed for command line syntax errors. Fixes #8465.
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
using System;
|
|
using FluentAssertions;
|
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
|
using Xunit;
|
|
|
|
namespace Microsoft.DotNet.Cli.Install.Tests
|
|
{
|
|
public class GivenDotnetInstallTool : TestBase
|
|
{
|
|
[Fact]
|
|
public void ItRunsWithQuietVerbosityByDefault()
|
|
{
|
|
var result = new InstallCommand()
|
|
.ExecuteWithCapturedOutput("tool -g nonexistent_tool_package");
|
|
|
|
result
|
|
.Should()
|
|
.Fail()
|
|
.And
|
|
.NotHaveStdOutContaining("Restoring");
|
|
}
|
|
|
|
[Fact]
|
|
public void ItRunsWithTheSpecifiedVerbosity()
|
|
{
|
|
var result = new InstallCommand()
|
|
.ExecuteWithCapturedOutput("tool -g -v:m nonexistent_tool_package");
|
|
|
|
result
|
|
.Should()
|
|
.Fail();
|
|
|
|
result
|
|
.StdOut
|
|
.Should()
|
|
.ContainVisuallySameFragmentIfNotLocalized("Restoring");
|
|
}
|
|
}
|
|
}
|