Skip to content

Remove WasmFingerprintDotnetJs tests and add OverrideHtmlAssetPlaceholders tests #112859

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

Merged
merged 18 commits into from
Apr 23, 2025

Conversation

ilonatommy
Copy link
Member

@ilonatommy ilonatommy commented Feb 24, 2025

Fixes #112814.

  1. Blazor does not support running with WasmFingerprintDotnetJs - Blazor imports dotnet.js explicitly and setting this property would break this import. From this reason - remove the WBT testing it from Blazor.

  2. Wasm browser apps support WasmFingerprintDotnetJs, however, there is an issue connected with running WBT asset apps that has WasmFingerprintDotnetJs=true. We cannot load the sources because in WBT we have also explicit

import { dotnet, exit } from './_framework/dotnet.js'

in our test app asset, so importing will fail. To keep it simple, we skip testing it there as well.

  1. Add WBT for WriteImportMapToHtml=true introduced in Write import map to html files sdk#46233. For both: blazor and browser wasm.

  2. Keep the extended logging in case of WBT assert failure.

@ilonatommy ilonatommy added arch-wasm WebAssembly architecture os-browser Browser variant of arch-wasm labels Feb 24, 2025
@ilonatommy ilonatommy added this to the 10.0.0 milestone Feb 24, 2025
@ilonatommy ilonatommy self-assigned this Feb 24, 2025
@Copilot Copilot AI review requested due to automatic review settings February 24, 2025 13:26
@ilonatommy ilonatommy requested a review from maraf as a code owner February 24, 2025 13:26
@ghost ghost added the area-Build-mono label Feb 24, 2025
Copy link
Contributor

@Copilot 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.

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

Comments suppressed due to low confidence (2)

src/mono/wasm/Wasm.Build.Tests/ProjectProviderBase.cs:122

  • Uncommenting this debug logging line may clutter the test output during normal runs. Consider gating the logging behind a verbose condition or a flag to keep output clean by default.
_testOutput.WriteLine("Comparing {expectedFilename} with {actualFile}, expectFingerprintOnDotnetJs: {expectFingerprintOnDotnetJs}, expectFingerprint: {expectFingerprint}");

src/mono/wasm/Wasm.Build.Tests/Common/EnvironmentVariables.cs:26

  • The environment variable key was changed from 'WASM_FINGERPRINT_DOTNET_JS' to 'USE_DOTNET_FINGERPRINTING_FOR_TESTS'; please ensure that all test configurations and dependent code are updated to reflect this change.
internal static readonly bool UseFingerprintingDotnetJS    = Environment.GetEnvironmentVariable("USE_DOTNET_FINGERPRINTING_FOR_TESTS") is "true";

Copy link
Member

@lewing lewing left a comment

Choose a reason for hiding this comment

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

did you mean to leave the test output line in the pr?

@ilonatommy
Copy link
Member Author

Yes, I did. Do you think it's too noisy? If it was there, it would have shortened the investigation. I could also collect the text from 122 and print only in line 152, when we for sure throw.

@ilonatommy ilonatommy changed the title Fix information flow about fingerprinting dotnet files in WBT Correct WasmFingerprintDotnetJs tests and add WriteImportMapToHtml tests Feb 25, 2025
@ilonatommy ilonatommy marked this pull request as ready for review February 25, 2025 16:01
@ilonatommy ilonatommy changed the title Correct WasmFingerprintDotnetJs tests and add WriteImportMapToHtml tests Remove WasmFingerprintDotnetJs tests and add WriteImportMapToHtml tests Feb 25, 2025
@ilonatommy
Copy link
Member Author

WriteImportMapToHtml didn't flow in yet to WBT

@ilonatommy
Copy link
Member Author

After consulting with @maraf, the mapping mechanism needs a small update. This PR should wait until the update is merged to sdk and propagated to WBT.
We are including soft fingerprinted files (profiler.js, main.js) into html map. While importing main.js is not affected by the mapping because it's imported by <script type='module' src="./main.js" />, the profiler.js is - we are trying to import the file with fingerprinted name but it does not exist.

@maraf
Copy link
Member

maraf commented Apr 2, 2025

Because of the rename we should wait for dotnet/sdk#47915 😬

@ilonatommy ilonatommy changed the title Remove WasmFingerprintDotnetJs tests and add WriteImportMapToHtml tests Remove WasmFingerprintDotnetJs tests and add OverrideHtmlAssetPlaceholders tests Apr 11, 2025
@ilonatommy ilonatommy requested a review from akoeplinger as a code owner April 11, 2025 07:05
@ilonatommy ilonatommy merged commit 56a9de3 into dotnet:main Apr 23, 2025
26 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Evaluate fingerprinting test data in Blazor.BuildPublishTests.DefaultTemplate_CheckFingerprinting
4 participants