-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[browser] rename test-main.mjs #124270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[browser] rename test-main.mjs #124270
Conversation
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
There was a problem hiding this 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.mjsinstead oftest-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. |
| File.Copy(Path.Combine(AppContext.BaseDirectory, "test-main.mjs"), | ||
| Path.Combine(_projectDir, "test-main.mjs")); |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
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.
| 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")); |
fc180f5 to
f0fc051
Compare
so that V8 testing works without
--module