@@ -28,7 +28,7 @@ export async function cliProgram({
2828 const implementationMappings = await createImplementationMappings (
2929 implementationPath ,
3030 outDir ,
31- testCaseJson
31+ testCaseJson ,
3232 ) ;
3333
3434 for ( const ruleId of getRuleIds ( testCaseJson ) ) {
@@ -41,7 +41,7 @@ export async function cliProgram({
4141async function createImplementationMappings (
4242 implementationPath : string ,
4343 outDir : string ,
44- testCasesJson : TestCaseJson
44+ testCasesJson : TestCaseJson ,
4545) : Promise < ActImplementationReport [ ] > {
4646 const implementations = loadImplementations ( implementationPath ) ;
4747 const implementationMappings : ActImplementationReport [ ] = [ ] ;
@@ -54,7 +54,7 @@ async function createImplementationMappings(
5454 {
5555 name,
5656 vendor,
57- }
57+ } ,
5858 ) ;
5959 const filePath = path . resolve ( outDir , `${ filenameEscape ( name ) } .json` ) ;
6060 console . log ( `Writing file ${ filePath } ` ) ;
@@ -69,8 +69,14 @@ function loadImplementations(implementationPath: string): Implementation[] {
6969 if ( typeof yamlData !== "object" || yamlData === null ) {
7070 return [ ] ;
7171 }
72+ const yamlRecord = yamlData as Record < string , unknown > ;
7273 const implementations : Implementation [ ] = [ ] ;
73- Object . entries ( yamlData ) . forEach ( ( [ name , { vendor, report } ] ) => {
74+ Object . entries ( yamlRecord ) . forEach ( ( [ name , entry ] ) => {
75+ if ( typeof entry !== "object" || entry === null ) {
76+ console . warn ( `Failed to load ${ name } . Properties missing or invalid` ) ;
77+ return ;
78+ }
79+ const { vendor, report } = entry as Record < string , unknown > ;
7480 if ( typeof vendor === "string" && typeof report === "string" ) {
7581 implementations . push ( { name, vendor, report } ) ;
7682 } else {
0 commit comments