abort build when an unresolved dependency is found (#2696)
This commit is contained in:
parent
f8300f8747
commit
b98bc1289d
13 changed files with 122 additions and 8 deletions
|
@ -214,6 +214,27 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UnresolvedReferenceCausesBuildToFailAndNotProduceOutput()
|
||||
{
|
||||
var testAssetsManager = GetTestGroupTestAssetsManager("NonRestoredTestProjects");
|
||||
var testInstance = testAssetsManager.CreateTestInstance("TestProjectWithUnresolvedDependency")
|
||||
.WithLockFiles();
|
||||
|
||||
var restoreResult = new RestoreCommand() { WorkingDirectory = testInstance.TestRoot }.Execute();
|
||||
restoreResult.Should().Fail();
|
||||
new DirectoryInfo(testInstance.TestRoot).Should().HaveFile("project.lock.json");
|
||||
|
||||
var buildCmd = new BuildCommand(testInstance.TestRoot);
|
||||
var buildResult = buildCmd.ExecuteWithCapturedOutput();
|
||||
buildResult.Should().Fail();
|
||||
|
||||
buildResult.StdErr.Should().Contain("The dependency ThisIsNotARealDependencyAndIfSomeoneGoesAndAddsAProjectWithThisNameIWillFindThemAndPunishThem could not be resolved.");
|
||||
|
||||
var outputDir = new DirectoryInfo(Path.Combine(testInstance.TestRoot, "bin", "Debug", "netcoreapp1.0"));
|
||||
outputDir.GetFiles().Length.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PackageReferenceWithResourcesTest()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue