@@ -11388,10 +11388,9 @@ function assertNoUnclassifiedStaleAuthority(entries, allowlist = []) {
1138811388 ( descriptor ) =>
1138911389 descriptor . filename === occurrence . filename &&
1139011390 descriptor . marker === occurrence . marker &&
11391- descriptorValue ( descriptor . scopeTemplate , descriptor . marker ) ===
11392- occurrence . scope &&
11391+ descriptorValue ( descriptor . scopeTemplate ) === occurrence . scope &&
1139311392 occurrence . lineContext ===
11394- descriptorValue ( descriptor . lineContextTemplate , descriptor . marker ) ,
11393+ descriptorValue ( descriptor . lineContextTemplate ) ,
1139511394 ) ;
1139611395 if ( descriptorIndex === - 1 ) {
1139711396 unclassified . push ( occurrence ) ;
@@ -11404,11 +11403,8 @@ function assertNoUnclassifiedStaleAuthority(entries, allowlist = []) {
1140411403 ...descriptor ,
1140511404 occurrence : "missing expected occurrence" ,
1140611405 lineNumber : "missing" ,
11407- lineContext : descriptorValue (
11408- descriptor . lineContextTemplate ,
11409- descriptor . marker ,
11410- ) ,
11411- scope : descriptorValue ( descriptor . scopeTemplate , descriptor . marker ) ,
11406+ lineContext : descriptorValue ( descriptor . lineContextTemplate ) ,
11407+ scope : descriptorValue ( descriptor . scopeTemplate ) ,
1141211408 } ) ) ,
1141311409 ) ;
1141411410 assert . equal (
@@ -11878,7 +11874,7 @@ const staleDescriptorValues = Object.freeze({
1187811874 "https://github.com/earendil-works/pi/tree/" + "main/" ,
1187911875} ) ;
1188011876
11881- function descriptorValue ( template , marker ) {
11877+ function descriptorValue ( template ) {
1188211878 let value = template ;
1188311879 for ( const [ token , markerValue ] of Object . entries ( staleDescriptorValues ) ) {
1188411880 value = value . replaceAll ( token , markerValue ) ;
@@ -11907,6 +11903,27 @@ function formatStaleAuthorityDescriptorTemplates(entries) {
1190711903 ) ;
1190811904}
1190911905
11906+ test ( "stale descriptor formatter emits readable exact historical templates" , ( ) => {
11907+ const historicalVersion = "0.87" + ".1" ;
11908+ const templates = JSON . parse (
11909+ formatStaleAuthorityDescriptorTemplates ( [
11910+ {
11911+ filename : "fixtures/historical-migration.mjs" ,
11912+ source : `test("historical fixture", () => {\n const version = "${ historicalVersion } ";\n});` ,
11913+ } ,
11914+ ] ) ,
11915+ ) ;
11916+
11917+ assert . deepEqual ( templates , [
11918+ {
11919+ filename : "fixtures/historical-migration.mjs" ,
11920+ marker : "old-version" ,
11921+ lineContextTemplate : 'const version = "<STALE:old-version>";' ,
11922+ scopeTemplate : "test:historical fixture" ,
11923+ } ,
11924+ ] ) ;
11925+ } ) ;
11926+
1191011927async function readStaleAuthoritySources ( ) {
1191111928 async function readTree ( relativeDirectory ) {
1191211929 const directoryURL = new URL ( `${ relativeDirectory } /` , repositoryRoot ) ;
0 commit comments