Skip to content

Fix update-test-baselines scripts and SWA baseline fingerprint normalization for MTP#55027

Merged
maraf merged 7 commits into
mainfrom
maraf/mtp-baseline-fixes
Jun 30, 2026
Merged

Fix update-test-baselines scripts and SWA baseline fingerprint normalization for MTP#55027
maraf merged 7 commits into
mainfrom
maraf/mtp-baseline-fixes

Conversation

@maraf

@maraf maraf commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

Fixes two related issues after the xUnit → MSTest/MTP migration.

1. Fix update-test-baselines scripts

The scripts used xUnit/VSTest-era conventions that no longer work with MTP:

Before After Reason
--filter AspNetCore=BaselineTest --filter "TestCategory=BaselineTest" xUnit trait → MSTest [TestCategory]
-l "console;verbosity=normal" -v normal VSTest logger silently produces zero tests in MTP mode
-e KEY=VALUE --environment KEY=VALUE MTP-compatible flag

Also enables MTP runner: adds "test": { "runner": "Microsoft.Testing.Platform" } to global.json and UseMicrosoftTestingPlatformRunner=true for MSTest.Sdk projects in test/Directory.Build.props (MTP package v2.3+ refuses VSTest on .NET 10+ SDK).

2. Fix hardcoded fingerprints in SWA baselines

Commit bcdeca9 introduced hardcoded fingerprints (e.g. blazor.web.js.gon0ccxxql.map.gz) in 24 baseline JSON Route fields. StaticWebAssetsBaselineFactory had no pattern for .{fingerprint}.map(.gz|.br)? source map files, so they were never normalized.

Fix: Added SourceMapFileRegex to WellKnownFileNamePatternsAndReplacements and updated all 24 affected baseline files to use the __fingerprint__ placeholder.

3. Update baseline regeneration instructions

Updated StaticWebAssetsBaselineComparer.cs and the swa-baseline-regeneration skill to reflect the new script invocation (-v normal, --environment, "TestCategory=BaselineTest") and to specify -c Release when building the repo before regenerating baselines.

maraf and others added 3 commits June 26, 2026 13:35
…ization for MTP

- Enable MTP runner in global.json (required on .NET 10+ SDK)
- Enable UseMicrosoftTestingPlatformRunner for MSTest.Sdk projects in test/Directory.Build.props
- Update update-test-baselines.ps1 and .sh:
  - Filter: AspNetCore=BaselineTest -> TestCategory=BaselineTest (xUnit trait -> MSTest category)
  - Logger: -l "console;verbosity=normal" -> -v normal (VSTest logger breaks MTP filter)
  - Env var: -e -> --environment (MTP-compatible flag)
- Fix StaticWebAssetsBaselineFactory to normalize fingerprinted source map routes
  by adding SourceMapFileRegex for {name}.{fingerprint}.map(.gz|.br)? patterns
- Update 24 baseline JSON files to replace hardcoded fingerprints in Route fields
  with __fingerprint__ placeholder (blazor.server.js / blazor.web.js .map routes)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread .claude/skills/swa-baseline-regeneration/SKILL.md Outdated
Comment thread test/Directory.Build.props Outdated
maraf and others added 2 commits June 26, 2026 14:17
- Use --project <TestProject> flag instead of positional directory arg
  in both scripts and SKILL.md
- Remove UseMicrosoftTestingPlatformRunner=true from Directory.Build.props;
  it's xUnit syntax and is not needed when using MSTest.Sdk

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Microsoft.NET.Sdk.Razor.Tests has no BaselineTest tests, causing
exit code 8 (zero tests ran). Also sync .sh with .ps1 by including
Microsoft.NET.Sdk.StaticWebAssets.Tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread src/RazorSdk/update-test-baselines.sh
@maraf maraf marked this pull request as ready for review June 30, 2026 18:06
@maraf maraf requested review from lbussell and mthalman as code owners June 30, 2026 18:06
Copilot AI review requested due to automatic review settings June 30, 2026 18:06
@maraf maraf requested a review from a team as a code owner June 30, 2026 18:06
@maraf maraf enabled auto-merge (squash) June 30, 2026 18:07

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 fixes baseline regeneration and static web asset (SWA) baseline stability after the xUnit → MSTest / Microsoft.Testing.Platform (MTP) migration by updating the baseline update scripts, enabling the MTP runner via global.json, and normalizing previously hardcoded source-map fingerprints in SWA baseline manifests.

Changes:

  • Update update-test-baselines scripts to use MTP-compatible flags (--project, -v normal, --environment, and --filter "TestCategory=BaselineTest").
  • Add source-map fingerprint normalization to StaticWebAssetsBaselineFactory and update affected SWA baseline JSON files to use __fingerprint__.
  • Enable the MTP runner via global.json and update baseline regeneration instructions.

Reviewed changes

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

Show a summary per file
File Description
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Rebuild_RegeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json Replace hardcoded .map(.gz) fingerprint routes with __fingerprint__ placeholders.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Rebuild_RegeneratesJsonManifestAndCopiesItToOutputFolder_Rebuild.Build.staticwebassets.json Replace hardcoded .map(.gz) fingerprint routes with __fingerprint__ placeholders.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Publish_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz, .map.br) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Publish_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Publish_PublishesJsModuleBundleBundleToTheRightLocation.Publish.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz, .map.br) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Publish_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz, .map.br) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Publish_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Publish_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz, .map.br) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Publish_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Publish_CreatesEndpointsForAssets.Publish.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz, .map.br) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Publish_CreatesEndpointsForAssets_BuildAndPublish_Assets.Publish.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz, .map.br) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Clean_RemovesManifestFrom_BuildAndIntermediateOutput.Build.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_UpdatesManifest_WhenFilesChange.Build.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_UpdatesManifest_WhenFilesChange_Updated.Build.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_GeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_FingerprintsContent_WhenEnabled.Build.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_DoesNotUpdateManifest_WhenHasNotChanged.Build.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_DoesNotFailToCompress_TwoAssetsWith_TheSameContent.Build.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_DiscoversJsModulesBasedOnPatterns.Build.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz, .map.br) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_DefaultDocumentAndSpaFallback_CreatesAdditionalEndpoints.Build.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_CreatesEndpointsForAssets.Build.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/Build_Can_DisableAssetCaching.Build.staticwebassets.json Normalize fingerprinted source-map routes (.map, .map.gz) to __fingerprint__.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselineFactory.cs Add a regex rule to normalize fingerprinted source-map filenames (`*.{fingerprint}.map(.gz
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselineComparer.cs Update baseline regeneration instructions to build in Release.
src/RazorSdk/update-test-baselines.sh Update script to use MTP-compatible dotnet test flags and MSTest category filtering.
src/RazorSdk/update-test-baselines.ps1 Update script to use MTP-compatible dotnet test flags and MSTest category filtering.
global.json Enable the MTP test runner via "test": { "runner": "Microsoft.Testing.Platform" }.
.claude/skills/swa-baseline-regeneration/SKILL.md Update documented baseline regeneration commands to match new runner/flags.

@maraf maraf merged commit df8e062 into main Jun 30, 2026
26 checks passed
@maraf maraf deleted the maraf/mtp-baseline-fixes branch June 30, 2026 22:08
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants