@@ -553,7 +553,8 @@ public string CreateBlazorWasmTemplateProject(string id)
553553 AssertBlazorBundle ( options . Config ,
554554 isPublish : false ,
555555 dotnetWasmFromRuntimePack : options . ExpectedFileType == NativeFilesType . FromRuntimePack ,
556- targetFramework : options . TargetFramework ) ;
556+ targetFramework : options . TargetFramework ,
557+ expectFingerprintOnDotnetJs : options . ExpectFingerprintOnDotnetJs ) ;
557558
558559 return res ;
559560 }
@@ -565,7 +566,8 @@ public string CreateBlazorWasmTemplateProject(string id)
565566 AssertBlazorBundle ( options . Config ,
566567 isPublish : true ,
567568 dotnetWasmFromRuntimePack : options . ExpectedFileType == NativeFilesType . FromRuntimePack ,
568- targetFramework : options . TargetFramework ) ;
569+ targetFramework : options . TargetFramework ,
570+ expectFingerprintOnDotnetJs : options . ExpectFingerprintOnDotnetJs ) ;
569571
570572 if ( options . ExpectedFileType == NativeFilesType . AOT )
571573 {
@@ -581,7 +583,7 @@ public string CreateBlazorWasmTemplateProject(string id)
581583 string objBuildDir = Path . Combine ( _projectDir ! , "obj" , options . Config , options . TargetFramework , "wasm" , "for-build" ) ;
582584 // Check that we linked only for publish
583585 if ( options . ExpectRelinkDirWhenPublishing )
584- Assert . True ( Directory . Exists ( objBuildDir ) , $ "Could not find expected { objBuildDir } , which gets created when relinking during Build. This is liokely a test authoring error") ;
586+ Assert . True ( Directory . Exists ( objBuildDir ) , $ "Could not find expected { objBuildDir } , which gets created when relinking during Build. This is likely a test authoring error") ;
585587 else
586588 Assert . False ( Directory . Exists ( objBuildDir ) , $ "Found unexpected { objBuildDir } , which gets created when relinking during Build") ;
587589
@@ -829,7 +831,7 @@ protected static void AssertFile(string file0, string file1, string? label = nul
829831 return result ;
830832 }
831833
832- protected void AssertBlazorBundle ( string config , bool isPublish , bool dotnetWasmFromRuntimePack , string targetFramework = DefaultTargetFrameworkForBlazor , string ? binFrameworkDir = null , bool expectFingerprinting = false )
834+ protected void AssertBlazorBundle ( string config , bool isPublish , bool dotnetWasmFromRuntimePack , string targetFramework = DefaultTargetFrameworkForBlazor , string ? binFrameworkDir = null , bool expectFingerprintOnDotnetJs = false )
833835 {
834836 binFrameworkDir ??= FindBlazorBinFrameworkDir ( config , isPublish , targetFramework ) ;
835837
@@ -861,12 +863,21 @@ void AssertFileExists(string fileName)
861863 Assert . True ( File . Exists ( absolutePath ) , $ "Expected to find '{ absolutePath } '") ;
862864 }
863865
864- string versionHashRegex = @"\d.0.\d?(-[a-z]+(\.\d\.\d+\.\d)?)?\.([a-zA-Z0-9])+" ;
866+ string versionHashRegex = @"\.(?<version>.+)\.(?<hash>[a-zA-Z0-9]+)\." ;
867+
865868 Assert . Collection (
866869 dotnetJsEntries . OrderBy ( f => f ) ,
867- item => { Assert . Equal ( expectFingerprinting ? $ "dotnet\\ .{ versionHashRegex } \\ .js" : "dotnet.js" , item ) ; AssertFileExists ( item ) ; } ,
868- item => { Assert . Matches ( $ "dotnet\\ .native\\ .{ versionHashRegex } \\ .js", item ) ; AssertFileExists ( item ) ; } ,
869- item => { Assert . Matches ( $ "dotnet\\ .runtime\\ .{ versionHashRegex } \\ .js", item ) ; AssertFileExists ( item ) ; }
870+ item =>
871+ {
872+ if ( expectFingerprintOnDotnetJs )
873+ Assert . Matches ( $ "dotnet{ versionHashRegex } js", item ) ;
874+ else
875+ Assert . Equal ( "dotnet.js" , item ) ;
876+
877+ AssertFileExists ( item ) ;
878+ } ,
879+ item => { Assert . Matches ( $ "dotnet\\ .native{ versionHashRegex } js", item ) ; AssertFileExists ( item ) ; } ,
880+ item => { Assert . Matches ( $ "dotnet\\ .runtime{ versionHashRegex } js", item ) ; AssertFileExists ( item ) ; }
870881 ) ;
871882 }
872883 }
@@ -1295,7 +1306,8 @@ public record BlazorBuildOptions
12951306 NativeFilesType ExpectedFileType ,
12961307 string TargetFramework = BuildTestBase . DefaultTargetFrameworkForBlazor ,
12971308 bool WarnAsError = true ,
1298- bool ExpectRelinkDirWhenPublishing = false
1309+ bool ExpectRelinkDirWhenPublishing = false ,
1310+ bool ExpectFingerprintOnDotnetJs = false
12991311 ) ;
13001312
13011313 public enum GlobalizationMode
0 commit comments