Skip to content

Commit 49185a9

Browse files
committed
Improve Unit Tests: track the compression flag breaking change
- dotnet/announcements#283
1 parent 1a6500b commit 49185a9

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

BlazorWasmPreRendering.Build.Test/ProgramE2ETest.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public async Task Including_ServerSide_Middleware_from_AssemblyMetaData_TestAsyn
106106
var serverPort = Program.GetAvailableTcpPort("5050-5999");
107107

108108
using var dotnetCLI = Start(
109-
"dotnet", $"publish -c:Release -p:PublishTrimmed=false -p:BlazorWasmPrerenderingKeepServer=true -p:BlazorEnableCompression=false -p:UsingBrowserRuntimeWorkload=false -p:BlazorWasmPrerenderingServerPort={serverPort}",
109+
"dotnet", $"publish -c:Release -p:PublishTrimmed=false -p:BlazorWasmPrerenderingKeepServer=true -p:CompressionEnabled=false -p:UsingBrowserRuntimeWorkload=false -p:BlazorWasmPrerenderingServerPort={serverPort}",
110110
projectDir,
111111
options => options.WhenDisposing = XProcessTerminate.EntireProcessTree);
112112
var success = await dotnetCLI.WaitForOutputAsync(output => output.Trim().StartsWith("Start fetching..."), millsecondsTimeout: 40000);
@@ -328,7 +328,7 @@ public async Task Publish_Test()
328328
Console.WriteLine($"{(i == 1 ? "1st" : "2nd")} time publishing...");
329329

330330
// When
331-
var arg = "publish -c:Release -p:BlazorEnableCompression=false -p:UsingBrowserRuntimeWorkload=false -o:bin/publish";
331+
var arg = "publish -c:Release -p:CompressionEnabled=false -p:UsingBrowserRuntimeWorkload=false -o:bin/publish";
332332
// if 2nd time publishing, override the environment name.
333333
if (i == 2) arg += " -p:BlazorWasmPrerenderingEnvironment=" + expectedEnvNames[2];
334334

@@ -374,7 +374,7 @@ public async Task Publish_by_native_msbuild_Test()
374374
// When
375375
await Start("dotnet", "restore", app0Dir).WaitForExitAsync();
376376
var msbuild = await Start(msbuildPath,
377-
"-p:Configuration=Debug -p:BlazorEnableCompression=false -p:DeployOnBuild=true -p:PublishUrl=bin/publish",
377+
"-p:Configuration=Debug -p:CompressionEnabled=false -p:DeployOnBuild=true -p:PublishUrl=bin/publish",
378378
app0Dir).WaitForExitAsync();
379379
msbuild.ExitCode.Is(0, message: msbuild.StdOutput + msbuild.StdError);
380380

@@ -399,7 +399,7 @@ public async Task Publish_by_msbuild_Test()
399399
// When
400400
await Start("dotnet", "restore", app0Dir).WaitForExitAsync();
401401
var dotnetCLI = await Start("dotnet",
402-
"msbuild -p:Configuration=Debug -p:BlazorEnableCompression=false -p:DeployOnBuild=true -p:PublishUrl=bin/publish",
402+
"msbuild -p:Configuration=Debug -p:CompressionEnabled=false -p:DeployOnBuild=true -p:PublishUrl=bin/publish",
403403
app0Dir).WaitForExitAsync();
404404
dotnetCLI.ExitCode.Is(0, message: dotnetCLI.StdOutput + dotnetCLI.StdError);
405405

@@ -426,7 +426,7 @@ public async Task Publish_with_HTTP500_Test(string env, bool msg1, bool msg2)
426426
var dotnetCLI = await Start("dotnet", "publish " +
427427
$"-c:Release " +
428428
$"-p:BlazorWasmPrerenderingEnvironment={env} " +
429-
$"-p:BlazorEnableCompression=false " +
429+
$"-p:CompressionEnabled=false " +
430430
$"-p:BlazorWasmPrerenderingServerPort={tcpPort} " +
431431
$"--nologo",
432432
projectDir).WaitForExitAsync();
@@ -462,7 +462,7 @@ public async Task Publish_BlazorWasmAntivirusProtection_Test(string obfuscationM
462462
{
463463
$"publish",
464464
$"-c:Release",
465-
$"-p:BlazorEnableCompression=false",
465+
$"-p:CompressionEnabled=false",
466466
$"-p:UsingBrowserRuntimeWorkload=false",
467467
$"-p:BlazorWasmPrerenderingServerPort={tcpPort}",
468468
$"-o:bin/publish",
@@ -491,7 +491,7 @@ public async Task AppSettings_Test()
491491
File.WriteAllText(Path.Combine(projectDir, "wwwroot", "appsettings.json"), @"{""HomeTitle"":""127.0.0.1""}");
492492

493493
// When
494-
var dotnetCLI = await XProcess.Start("dotnet", "publish -c:Debug -p:BlazorEnableCompression=false -o:bin/publish", projectDir).WaitForExitAsync();
494+
var dotnetCLI = await XProcess.Start("dotnet", "publish -c:Debug -p:CompressionEnabled=false -o:bin/publish", projectDir).WaitForExitAsync();
495495
dotnetCLI.ExitCode.Is(0, message: dotnetCLI.StdOutput + dotnetCLI.StdError);
496496

497497
// Then
@@ -541,7 +541,7 @@ public async Task ServeDotFile_Test()
541541
var serverPort = Program.GetAvailableTcpPort("5050-5999");
542542

543543
using var dotnetCLI = Start(
544-
"dotnet", $"publish -c:Release -p:PublishTrimmed=false -p:BlazorWasmPrerenderingKeepServer=true -p:BlazorEnableCompression=false -p:UsingBrowserRuntimeWorkload=false -p:BlazorWasmPrerenderingServerPort={serverPort}",
544+
"dotnet", $"publish -c:Release -p:PublishTrimmed=false -p:BlazorWasmPrerenderingKeepServer=true -p:CompressionEnabled=false -p:UsingBrowserRuntimeWorkload=false -p:BlazorWasmPrerenderingServerPort={serverPort}",
545545
projectDir,
546546
options => options.WhenDisposing = XProcessTerminate.EntireProcessTree);
547547
var success = await dotnetCLI.WaitForOutputAsync(output => output.Trim().StartsWith("Start fetching..."), millsecondsTimeout: 40000);

BlazorWasmPreRendering.Build.Test/_Fixtures/SampleSite.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public async ValueTask<WorkDirectory> PublishAsync()
7979
{
8080
var publishProcess = XProcess.Start(
8181
"dotnet",
82-
$"publish -c:{this.Configuration} -p:BlazorWasmPrerendering=disable -p:BlazorEnableCompression=false -p:UsingBrowserRuntimeWorkload=false",
82+
$"publish -c:{this.Configuration} -p:BlazorWasmPrerendering=disable -p:CompressionEnabled=false -p:UsingBrowserRuntimeWorkload=false",
8383
workingDirectory: this.ProjectDir);
8484
await publishProcess.WaitForExitAsync();
8585
publishProcess.ExitCode.Is(0, message: publishProcess.StdOutput + publishProcess.StdError);

SampleApps/BlazorWasmApp1/BlazorWasmApp1.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Nullable>enable</Nullable>
66
<WarningsAsErrors>nullable</WarningsAsErrors>
77
<ImplicitUsings>enable</ImplicitUsings>
8-
<BlazorEnableCompression>true</BlazorEnableCompression>
8+
<CompressionEnabled>true</CompressionEnabled>
99
<BlazorWasmPrerenderingUrlPathToExplicitFetch>/easter-egg</BlazorWasmPrerenderingUrlPathToExplicitFetch>
1010

1111
<!-- https://andrewlock.net/fixing-build-warning-netsdk1138-when-building-end-of-life-projects-with-dotnet-5/#setting-checkeoltargetframework-to-remove-the-warning -->

0 commit comments

Comments
 (0)