Skip to content

[browser] Move boot config tests to Wasm.Build.Tests#131223

Merged
maraf merged 14 commits into
mainfrom
maraf/BrowserMoveBootConfigTests-main
Jul 25, 2026
Merged

[browser] Move boot config tests to Wasm.Build.Tests#131223
maraf merged 14 commits into
mainfrom
maraf/BrowserMoveBootConfigTests-main

Conversation

@maraf

@maraf maraf commented Jul 22, 2026

Copy link
Copy Markdown
Member

Move GenerateWasmBootJson tests from the temporary src/tasks.tests/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.Tests project into src/mono/wasm/Wasm.Build.Tests.

Changes:

  • add GenerateWasmBootJsonTests in Wasm.Build.Tests
  • add [TestCategory("no-workload")] to the moved test class
  • remove the old Pack.Tasks.Tests test file and csproj
  • remove obsolete InternalsVisibleTo from Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.csproj

Note

This PR description was generated with GitHub Copilot assistance.

Copilot AI and others added 10 commits July 22, 2026 17:41
When RuntimeConfigJsonPath is set and IsPublish is false, also check
for a runtimeconfig.dev.json file alongside the main config. If found,
merge its configProperties into the result, with dev values overriding
main config values. This allows the SDK to use runtimeconfig.dev.json
to set Hot Reload related switches in debug builds.

Fixes #130823
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b49d3786-9f03-4fd3-8076-28a73d639686
Minor formatting-only changes in `src/coreclr/jit/rangecheck.h` to wrap
long lines. No behavioral changes.
Move GenerateWasmBootJson test coverage from the temporary tasks.tests project into Wasm.Build.Tests, remove the obsolete tasks.tests csproj, and tag the moved tests as no-workload.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2db6a9dd-0c66-4a48-b2f6-36c7329a5e0e
Copilot AI review requested due to automatic review settings July 22, 2026 15:50
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@maraf maraf added arch-wasm WebAssembly architecture area-Infrastructure-mono os-browser Browser variant of arch-wasm test-enhancement Improvements of test source code and removed area-Build-mono labels Jul 22, 2026
@maraf maraf added this to the 11.0.0 milestone Jul 22, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @akoeplinger, @matouskozak, @simonrozsival
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR consolidates GenerateWasmBootJson unit tests into the main Wasm.Build.Tests test project and removes the now-redundant temporary Pack.Tasks.Tests test project, keeping WebAssembly SDK task testing in one place.

Changes:

  • Moved GenerateWasmBootJsonTests into src/mono/wasm/Wasm.Build.Tests.
  • Removed the old src/tasks.tests/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.Tests test project and its test file.
  • Removed the obsolete InternalsVisibleTo entry from Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.csproj.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.csproj Removes InternalsVisibleTo for the deleted Pack.Tasks.Tests project.
src/tasks.tests/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.Tests/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.Tests.csproj Deletes the temporary test project.
src/tasks.tests/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.Tests/GenerateWasmBootJsonTests.cs Deletes the old test implementation from the temporary project.
src/mono/wasm/Wasm.Build.Tests/GenerateWasmBootJsonTests.cs Adds the moved test class under Wasm.Build.Tests (including no-workload categorization).

Comment thread src/mono/wasm/Wasm.Build.Tests/GenerateWasmBootJsonTests.cs Outdated
Comment thread src/mono/wasm/Wasm.Build.Tests/GenerateWasmBootJsonTests.cs
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 543feee9-af37-42d8-8313-055510ee76d9
Copilot AI review requested due to automatic review settings July 23, 2026 16:13
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 543feee9-af37-42d8-8313-055510ee76d9

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

src/mono/wasm/Wasm.Build.Tests/GenerateWasmBootJsonTests.cs:187

  • GenerateWasmBootJson.ReadRuntimeConfigFiles is internal, and this repo already grants internals access to Wasm.Build.Tests via InternalsVisibleTo plus a ProjectReference. Using reflection here makes the test more brittle (name-based lookup, BindingFlags constraints, exceptions wrapped in TargetInvocationException) and hides compile-time signature changes. Prefer a direct call to the internal method instead of reflection.
        {
            public string Path { get; } = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetRandomFileName());

            public TempDirectory() => Directory.CreateDirectory(Path);

            public void Dispose()
            {
                try
                {
                    Directory.Delete(Path, recursive: true);

Comment thread src/mono/wasm/Wasm.Build.Tests/GenerateWasmBootJsonTests.cs Outdated
Comment thread src/mono/wasm/Wasm.Build.Tests/GenerateWasmBootJsonTests.cs
Copilot AI review requested due to automatic review settings July 23, 2026 16:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.csproj:21

  • PR description says the Pack.Tasks csproj removes an obsolete InternalsVisibleTo, but this change actually updates it to point to Wasm.Build.Tests (and it’s still needed for the moved tests to call the internal ReadRuntimeConfigFiles). Please update the PR description to reflect that the friend assembly was changed rather than removed, to avoid confusion for reviewers/backports.
  <ItemGroup>
    <InternalsVisibleTo Include="Wasm.Build.Tests" />
    <Compile Include="..\Common\Utils.cs" />

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 543feee9-af37-42d8-8313-055510ee76d9
Copilot AI review requested due to automatic review settings July 24, 2026 08:13
@maraf
maraf marked this pull request as ready for review July 24, 2026 08:13
@maraf
maraf requested a review from ilonatommy as a code owner July 24, 2026 08:13
@maraf
maraf enabled auto-merge (squash) July 24, 2026 08:14
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (3)

src/mono/wasm/Wasm.Build.Tests/GenerateWasmBootJsonTests.cs:193

  • InvokeReadRuntimeConfigFiles uses Type.GetMethod(name, flags) without specifying parameter types. If GenerateWasmBootJson ever gets another overload named ReadRuntimeConfigFiles, this will throw AmbiguousMatchException (bypassing the intended error message) or bind to an unexpected overload. Prefer the GetMethod overload that includes the expected parameter types so the failure mode is deterministic.
        private static RuntimeConfigData? InvokeReadRuntimeConfigFiles(string? mainConfigPath, string? devConfigPath)
        {
            MethodInfo? method = typeof(GenerateWasmBootJson).GetMethod(
                "ReadRuntimeConfigFiles",
                BindingFlags.Static | BindingFlags.NonPublic);

            if (method is null)
            {
                throw new InvalidOperationException(
                    $"{nameof(GenerateWasmBootJson)}.{nameof(InvokeReadRuntimeConfigFiles)} could not find private method " +
                    "'ReadRuntimeConfigFiles(string?, string?)'. The production method signature may have changed.");
            }

            object? result = method.Invoke(null, new object?[] { mainConfigPath, devConfigPath });
            return (RuntimeConfigData?)result;
        }

src/mono/wasm/Wasm.Build.Tests/GenerateWasmBootJsonTests.cs:216

  • TempDirectory.Dispose currently only swallows a small set of exceptions. If Directory.Delete throws other exceptions (e.g., PathTooLongException, SecurityException, ArgumentException), the test can fail during cleanup and mask the real assertion failure/success. For temp test directories, it’s typically safer to swallow all cleanup exceptions (ideally with a brief comment) to reduce flakiness.
            public void Dispose()
            {
                try
                {
                    Directory.Delete(Path, recursive: true);
                }
                catch (DirectoryNotFoundException)
                {
                }
                catch (IOException)
                {
                }
                catch (UnauthorizedAccessException)
                {
                }
            }

src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.csproj:24

  • GenerateWasmBootJson.ReadRuntimeConfigFiles is internal. The moved tests currently use reflection to call it, which loses compile-time checking and can fail at runtime if overloads/signatures change. Consider adding an InternalsVisibleTo for Wasm.Build.Tests and calling the method directly, or otherwise justify preferring reflection over a friend-assembly relationship for tests.
  <ItemGroup>
    <Compile Include="..\Common\Utils.cs" />
    <Compile Include="..\WasmAppBuilder\WebcilConverter.cs" />
    <Compile Include="..\WasmAppBuilder\LogAdapter.cs" />

    <ProjectReference Include="..\Microsoft.NET.WebAssembly.Webcil\Microsoft.NET.WebAssembly.Webcil.csproj" />

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 543feee9-af37-42d8-8313-055510ee76d9
Copilot AI review requested due to automatic review settings July 24, 2026 08:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

src/mono/wasm/Wasm.Build.Tests/GenerateWasmBootJsonTests.cs:18

  • The new test file is indented as if the file-scoped namespace had a block (the class and all members are shifted right). This is inconsistent with other Wasm.Build.Tests files that use file-scoped namespaces and will make future diffs noisy. Please reformat the file so the class starts at column 0 under namespace Wasm.Build.Tests; (and reindent the body accordingly).
namespace Wasm.Build.Tests;

    [TestCategory("no-workload")]
    public class GenerateWasmBootJsonTests
    {

src/mono/wasm/Wasm.Build.Tests/GenerateWasmBootJsonTests.cs:184

  • The reflection lookup for ReadRuntimeConfigFiles is brittle: it only searches NonPublic methods and doesn't specify parameter types, so it will fail if the method ever becomes public or gains overloads (AmbiguousMatchException), even though the test could still work. Also the exception message says "private" but the method is currently internal.

Consider making the lookup tolerant by including BindingFlags.Public and matching the exact parameter types, and adjust the message to say "non-public".

            MethodInfo? method = typeof(GenerateWasmBootJson).GetMethod(
                "ReadRuntimeConfigFiles",
                BindingFlags.Static | BindingFlags.NonPublic);

            if (method is null)

@maraf
maraf merged commit d4524ad into main Jul 25, 2026
147 of 159 checks passed
@maraf
maraf deleted the maraf/BrowserMoveBootConfigTests-main branch July 25, 2026 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-Infrastructure-mono os-browser Browser variant of arch-wasm test-enhancement Improvements of test source code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants