Skip to content

[browser][mono] simplify internal testing switches - #122616

Merged
pavelsavara merged 5 commits into
dotnet:mainfrom
pavelsavara:browser_mono_internal
Dec 18, 2025
Merged

[browser][mono] simplify internal testing switches#122616
pavelsavara merged 5 commits into
dotnet:mainfrom
pavelsavara:browser_mono_internal

Conversation

@pavelsavara

Copy link
Copy Markdown
Member

transforming those from API methods to flags, allows independent JS module other than dotnet.js to implement the functionality.

Contributes to #101169

@pavelsavarapavelsavara added this to the 11.0.0 milestone Dec 17, 2025
@pavelsavarapavelsavara self-assigned this Dec 17, 2025
@pavelsavarapavelsavara added arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript os-browser Browser variant of arch-wasm labels Dec 17, 2025
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

Comment threadsrc/mono/browser/runtime/types/internal.ts
Comment threadsrc/mono/browser/test-main.js Outdated
Comment threadsrc/mono/browser/test-main.js
Comment threadsrc/mono/sample/wasm/Directory.Build.targets Outdated

CopilotAI 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 refactors internal testing switches from dedicated API methods to configuration flags, enabling independent JavaScript modules (not just dotnet.js) to implement the functionality. This is part of the effort to modularize the WebAssembly runtime initialization.

Key changes:

  • Removed dedicated API methods like withElementOnExit(), withConsoleForwarding(), withExitCodeLogging(), etc.
  • Replaced them with a unified .withConfig() approach accepting configuration flags
  • Updated installUnhandledErrorHandler() to be called conditionally based on the config flag rather than within a method

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
src/tests/FunctionalTests/WebAssembly/Browser/HotReload/main.jsConverts .withElementOnExit() to .withConfig({ appendElementOnExit: true })
src/mono/wasm/testassets/WasmOnAspNetCore/WasmBrowserClient/wwwroot/main.jsConsolidates three method calls into a single .withConfig() call with three flags
src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.jsReplaces multiple chained method calls with unified config object approach
src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTestsBase.csUpdates C# test template generation to use new config syntax
src/mono/sample/wasm/browser/wwwroot/main.jsConverts testing switch methods to config flags
src/mono/sample/wasm/browser-threads/wwwroot/main.jsMerges testing flags into existing .withConfig() call
src/mono/sample/wasm/browser-shutdown/wwwroot/main.jsReplaces .withOnConfigLoaded() with .withModuleConfig({ onConfigLoaded: ... })
src/mono/sample/wasm/browser-profile/wwwroot/main.jsMoves testing flags into existing config object
src/mono/sample/wasm/browser-logprofile/wwwroot/main.jsConsolidates testing switches and fixes spacing in unrelated line
src/mono/sample/wasm/browser-eventpipe/wwwroot/main.jsConverts two method calls to config flags
src/mono/sample/wasm/browser-bench/wwwroot/main.jsRemoves two method calls and adds config flags (incomplete migration)
src/mono/sample/wasm/browser-advanced/wwwroot/main.jsMoves testing flag into existing config object
src/mono/sample/wasm/Directory.Build.targetsAdds additional nested build properties for better build configuration
src/mono/browser/test-main.jsConsolidates multiple testing method calls into unified config object
src/mono/browser/runtime/types/internal.tsRemoves obsolete linkerEnabled field from internal config type
src/mono/browser/runtime/loader/run.tsRemoves API methods and moves installUnhandledErrorHandler() call to be conditional on config flag
src/libraries/sendtohelix-browser.targetsUpdates comment to reference new config flag name instead of old method name

Comment threadsrc/mono/sample/wasm/browser-bench/wwwroot/main.js Outdated
pavelsavaraand others added 2 commits December 18, 2025 16:24
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jan 18, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasmWebAssembly architecturearea-System.Runtime.InteropServices.JavaScriptos-browserBrowser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@pavelsavara@maraf@radekdoulik