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

Commit ea467db

Browse files
committed
Update test to pass --no-restore to templates
1 parent 5aec446 commit ea467db

File tree

13 files changed

+20
-18
lines changed

13 files changed

+20
-18
lines changed

build_projects/dotnet-cli-build/GenerateNuGetPackagesArchiveVersion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public override bool Execute()
4747
{
4848
ToolPath = ToolPath,
4949
TemplateType = newArgs[0],
50-
TemplateArgs = newArgs[1] + $" --debug:ephemeral-hive -n TempProject -o \"{outputDir}\"",
50+
TemplateArgs = newArgs[1] + $" --debug:ephemeral-hive -n TempProject -o \"{outputDir}\" --no-restore",
5151
HostObject = HostObject,
5252
BuildEngine = BuildEngine
5353
};

src/dotnet/commands/dotnet-migrate/DotnetNewRedirector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public void CreateWithEphemeralHiveAndNoRestore(
1515
string outputDirectory,
1616
string workingDirectory)
1717
{
18-
RunCommand("new", new string[] { "console", "-o", workingDirectory, "--debug:ephemeral-hive" }, workingDirectory);
18+
RunCommand("new", new string[] { "console", "-o", workingDirectory, "--debug:ephemeral-hive", "--no-restore" }, workingDirectory);
1919
}
2020
private void RunCommand(string commandToExecute, IEnumerable<string> args, string workingDirectory)
2121
{

test/EndToEnd/GivenDotNetUsesMSBuild.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public void ItCanNewRestoreBuildRunCleanMSBuildProject()
1919
{
2020
string projectDirectory = directory.Path;
2121

22-
string newArgs = "console -f netcoreapp2.0 --debug:ephemeral-hive";
22+
string newArgs = "console -f netcoreapp2.0 --debug:ephemeral-hive --no-restore";
2323
new NewCommandShim()
2424
.WithWorkingDirectory(projectDirectory)
2525
.Execute(newArgs)

test/dotnet-add-reference.Tests/GivenDotnetAddReference.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ private ProjDir NewLib(string dir = null, [System.Runtime.CompilerServices.Calle
6868

6969
try
7070
{
71-
string args = $"classlib -o \"{projDir.Path}\" --debug:ephemeral-hive";
71+
string args = $"classlib -o \"{projDir.Path}\" --debug:ephemeral-hive --no-restore";
7272
new NewCommandShim()
7373
.WithWorkingDirectory(projDir.Path)
7474
.ExecuteWithCapturedOutput(args)

test/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void ItRunsWhenRestoringToSpecificPackageDir()
9393
string dir = "pkgs";
9494
string args = $"--packages {dir}";
9595

96-
string newArgs = $"console -f netcoreapp2.0 -o \"{rootPath}\" --debug:ephemeral-hive";
96+
string newArgs = $"console -f netcoreapp2.0 -o \"{rootPath}\" --debug:ephemeral-hive --no-restore";
9797
new NewCommandShim()
9898
.WithWorkingDirectory(rootPath)
9999
.Execute(newArgs)

test/dotnet-list-reference.Tests/GivenDotnetListReference.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ private ProjDir NewLib(string testProjectName = "temp", [System.Runtime.Compiler
209209

210210
try
211211
{
212-
string newArgs = $"classlib -o \"{dir.Path}\" --debug:ephemeral-hive";
212+
string newArgs = $"classlib -o \"{dir.Path}\" --debug:ephemeral-hive --no-restore";
213213
new NewCommandShim()
214214
.WithWorkingDirectory(dir.Path)
215215
.ExecuteWithCapturedOutput(newArgs)

test/dotnet-new.Tests/GivenThatIWantANewApp.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ public void When_dotnet_new_is_invoked_mupliple_times_it_should_fail()
2121

2222
new NewCommand()
2323
.WithWorkingDirectory(rootPath)
24-
.Execute($"console --debug:ephemeral-hive");
24+
.Execute($"console --debug:ephemeral-hive --no-restore");
2525

2626
DateTime expectedState = Directory.GetLastWriteTime(rootPath);
2727

2828
var result = new NewCommand()
2929
.WithWorkingDirectory(rootPath)
30-
.ExecuteWithCapturedOutput($"console --debug:ephemeral-hive");
30+
.ExecuteWithCapturedOutput($"console --debug:ephemeral-hive --no-restore");
3131

3232
DateTime actualState = Directory.GetLastWriteTime(rootPath);
3333

@@ -64,7 +64,7 @@ private void CreateAndRestoreNewProject(
6464

6565
new NewCommand()
6666
.WithWorkingDirectory(projectFolder)
67-
.Execute($"{projectType} --debug:ephemeral-hive")
67+
.Execute($"{projectType} --debug:ephemeral-hive --no-restore")
6868
.Should().Pass();
6969

7070
// https://github.com/dotnet/templating/issues/946 - remove DisableImplicitAssetTargetFallback once this is fixed.
@@ -87,7 +87,7 @@ public void NewProjectRestoresCorrectPackageVersion(string type, string property
8787

8888
new NewCommand()
8989
.WithWorkingDirectory(rootPath)
90-
.Execute($"{type} --name {projectName} -o . --debug:ephemeral-hive")
90+
.Execute($"{type} --name {projectName} -o . --debug:ephemeral-hive --no-restore")
9191
.Should().Pass();
9292

9393
new RestoreCommand()

test/dotnet-new.Tests/GivenThatIWantANewAppWithSpecifiedType.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ public void TemplateRestoresAndBuildsWithoutWarnings(
4242
bool skipSpaWebpackSteps)
4343
{
4444
string rootPath = TestAssets.CreateTestDirectory(identifier: $"{language}_{projectType}").FullName;
45+
//This works around the SPA templates not currently supporting the "--no-restore" switch
46+
string noRestoreDirective = skipSpaWebpackSteps ? "" : "--no-restore";
4547

4648
new TestCommand("dotnet") { WorkingDirectory = rootPath }
47-
.Execute($"new {projectType} -lang {language} -o {rootPath} --debug:ephemeral-hive")
49+
.Execute($"new {projectType} -lang {language} -o {rootPath} --debug:ephemeral-hive {noRestoreDirective}")
4850
.Should().Pass();
4951

5052
if (useNuGetConfigForAspNet)

test/dotnet-pack.Tests/PackTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public void ItPacksAppWhenRestoringToSpecificPackageDirectory()
245245
string dir = "pkgs";
246246
string args = $"--packages {dir}";
247247

248-
string newArgs = $"console -o \"{rootPath}\"";
248+
string newArgs = $"console -o \"{rootPath}\" --no-restore";
249249
new NewCommandShim()
250250
.WithWorkingDirectory(rootPath)
251251
.Execute(newArgs)

test/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public void ItPublishesAppWhenRestoringToSpecificPackageDirectory()
206206
string dir = "pkgs";
207207
string args = $"--packages {dir}";
208208

209-
string newArgs = $"console -o \"{rootPath}\"";
209+
string newArgs = $"console -o \"{rootPath}\" --no-restore";
210210
new NewCommandShim()
211211
.WithWorkingDirectory(rootPath)
212212
.Execute(newArgs)

0 commit comments

Comments
 (0)