Skip to content

Commit 2bbb5f1

Browse files
ilonatommyCopilotlewing
authored
Enable Wasm.Build.Tests.WasmTemplateTests.RunWithDifferentAppBundleLocations (#117985)
* Re-enable. * Indent. * Apply suggestion from @Copilot Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Larry Ewing <[email protected]>
1 parent a8fee60 commit 2bbb5f1

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ void AddTestData(bool runOutsideProjectDirectory)
7272

7373
[Theory, TestCategory("no-fingerprinting")]
7474
[MemberData(nameof(TestDataForAppBundleDir))]
75-
[ActiveIssue("https://github.com/dotnet/runtime/issues/108107")]
7675
public async Task RunWithDifferentAppBundleLocations(bool runOutsideProjectDirectory, string extraProperties)
7776
=> await BrowserRunTwiceWithAndThenWithoutBuildAsync(Configuration.Release, extraProperties, runOutsideProjectDirectory);
7877

@@ -83,13 +82,25 @@ private async Task BrowserRunTwiceWithAndThenWithoutBuildAsync(Configuration con
8382
UpdateBrowserMainJs();
8483

8584
string workingDir = runOutsideProjectDirectory ? BuildEnvironment.TmpPath : _projectDir;
85+
string projectFilePath = info.ProjectFilePath;
86+
if (runOutsideProjectDirectory)
87+
{
88+
// When running outside, the project is in a subdirectory of workingDir
89+
string? directoryName = Path.GetDirectoryName(projectFilePath);
90+
if (directoryName == null)
91+
throw new InvalidOperationException($"Invalid project file path: {projectFilePath}");
92+
93+
string projectDirName = Path.GetFileName(directoryName);
94+
string projectFileName = Path.GetFileName(projectFilePath);
95+
projectFilePath = Path.Combine(projectDirName, projectFileName);
96+
}
8697

8798
{
8899
using var runCommand = new RunCommand(s_buildEnv, _testOutput)
89100
.WithWorkingDirectory(workingDir);
90101

91102
await using var runner = new BrowserRunner(_testOutput);
92-
var page = await runner.RunAsync(runCommand, $"run --no-silent -c {config} --project \"{info.ProjectName}.csproj\" --forward-console");
103+
var page = await runner.RunAsync(runCommand, $"run --no-silent -c {config} --project \"{projectFilePath}\" --forward-console");
93104
await runner.WaitForExitMessageAsync(TimeSpan.FromMinutes(2));
94105
Assert.Contains("Hello, Browser!", string.Join(Environment.NewLine, runner.OutputLines));
95106
}
@@ -99,7 +110,7 @@ private async Task BrowserRunTwiceWithAndThenWithoutBuildAsync(Configuration con
99110
.WithWorkingDirectory(workingDir);
100111

101112
await using var runner = new BrowserRunner(_testOutput);
102-
var page = await runner.RunAsync(runCommand, $"run --no-silent -c {config} --no-build --project \"{info.ProjectName}.csproj\" --forward-console");
113+
var page = await runner.RunAsync(runCommand, $"run --no-silent -c {config} --no-build --project \"{projectFilePath}\" --forward-console");
103114
await runner.WaitForExitMessageAsync(TimeSpan.FromMinutes(2));
104115
Assert.Contains("Hello, Browser!", string.Join(Environment.NewLine, runner.OutputLines));
105116
}

0 commit comments

Comments
 (0)