Skip to content

Conversation

@pavelsavara
Copy link
Member

so that V8 testing works without --module

@pavelsavara pavelsavara added this to the 11.0.0 milestone Feb 11, 2026
@pavelsavara pavelsavara self-assigned this Feb 11, 2026
@pavelsavara pavelsavara added the arch-wasm WebAssembly architecture label Feb 11, 2026
Copilot AI review requested due to automatic review settings February 11, 2026 13:21
@dotnet-policy-service
Copy link
Contributor

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

Copy link
Contributor

Copilot AI left a comment

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 renames the WASM test runner entrypoint from test-main.js to test-main.mjs so V8 can treat it as an ES module by default (avoiding the need for --module).

Changes:

  • Update HTML entrypoints and build/test infrastructure to reference test-main.mjs instead of test-main.js.
  • Update various MSBuild project properties/items that copy or point to the test runner JS file.
  • Update logging/comments in the browser runtime/test harness to reflect the new filename and align formatting.

Reviewed changes

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

Show a summary per file
File Description
src/tests/Common/wasm-test-runner/index.html Update module script reference to test-main.mjs.
src/tests/Common/wasm-test-runner/WasmTestRunner.proj Point WasmMainJSPath at test-main.mjs in runtime-test/.
src/tests/Common/Directory.Build.targets Copy test-main.mjs into $(CORE_ROOT)\runtime-test\.
src/mono/wasm/data/aot-tests/ProxyProjectForAOTOnHelix.proj Update WasmMainJSPath to test-main.mjs.
src/mono/wasm/Wasm.Build.Tests/Wasm.Build.Tests.csproj Copy test-main.mjs to test output instead of test-main.js.
src/mono/wasi/Wasi.Build.Tests/BuildTestBase.cs Copy test-main.mjs into generated temp projects.
src/mono/sample/wasm/browser-bench/Console/Wasm.Console.Bench.Sample.csproj Update WasmMainJSPath to test-main.mjs.
src/mono/sample/wasm/browser-bench/Console/Makefile Update MAIN_JS to test-main.mjs.
src/mono/browser/test-main.mjs Update log string to reflect .mjs name.
src/mono/browser/test-index.html Update module script reference to test-main.mjs.
src/mono/browser/runtime/loader/globals.ts Update “keep in sync” comment and minor formatting.
src/mono/browser/runtime/globals.ts Update “keep in sync” comment and minor formatting.
eng/testing/tests.browser.targets Copy/link test-main.mjs to wwwroot and default WasmMainJSPath to .mjs.
eng/testing/WasmRunnerTemplate.sh Default --js-file to test-main.mjs.
eng/testing/WasmRunnerTemplate.cmd Default --js-file to test-main.mjs.

Comment on lines +223 to +224
File.Copy(Path.Combine(AppContext.BaseDirectory, "test-main.mjs"),
Path.Combine(_projectDir, "test-main.mjs"));
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

BuildProject now copies test-main.mjs from AppContext.BaseDirectory, but Wasi.Build.Tests doesn't appear to include test-main.mjs as a copied test asset (unlike Wasm.Build.Tests.csproj, which explicitly copies it). This will likely throw FileNotFoundException when creating the temp project. Add test-main.mjs to the test output (e.g., via a <None Include="$(BrowserProjectRoot)\test-main.mjs" CopyToOutputDirectory=... /> in the Wasi.Build.Tests project/imported targets), or adjust the copy source to a path that is guaranteed to exist.

Suggested change
File.Copy(Path.Combine(AppContext.BaseDirectory, "test-main.mjs"),
Path.Combine(_projectDir, "test-main.mjs"));
string? sourceTestMainPath = Directory
.EnumerateFiles(AppContext.BaseDirectory, "test-main.mjs", SearchOption.AllDirectories)
.FirstOrDefault();
if (sourceTestMainPath is null)
throw new XunitException($"Could not find 'test-main.mjs' under '{AppContext.BaseDirectory}'.");
File.Copy(sourceTestMainPath, Path.Combine(_projectDir, "test-main.mjs"));

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant