@@ -27,7 +27,7 @@ addMediaTypePlugin("application/schema+yaml", {
2727 fileMatcher : ( path ) => path . endsWith ( ".yaml" )
2828} ) ;
2929
30- /** @type (testDirectory: string) => AsyncGenerator<Json> */
30+ /** @type (testDirectory: string) => AsyncGenerator<[string, Json] > */
3131const tests = async function * ( testDirectory ) {
3232 for ( const file of await readdir ( testDirectory , { recursive : true , withFileTypes : true } ) ) {
3333 if ( ! file . isFile ( ) || ! file . name . endsWith ( ".yaml" ) ) {
@@ -36,18 +36,21 @@ const tests = async function* (testDirectory) {
3636
3737 const testPath = join ( file . parentPath , file . name ) ;
3838 const testJson = await readFile ( testPath , "utf8" ) ;
39- yield YAML . parse ( testJson ) ;
39+
40+ yield [ testPath , YAML . parse ( testJson ) ] ;
4041 }
4142} ;
4243
4344/** @type (testDirectory: string) => Promise<void> */
4445const runTests = async ( testDirectory ) => {
45- for await ( const test of tests ( testDirectory ) ) {
46+ for await ( const [ name , test ] of tests ( testDirectory ) ) {
4647 const instance = Instance . fromJs ( test ) ;
4748
4849 const result = interpret ( compiled , instance , BASIC ) ;
49- //TODO: now result has errors array if valid is false
50- // if (!result.valid) console.log(result)
50+
51+ if ( ! result . valid ) {
52+ console . log ( "Failed:" , name , result . errors ) ;
53+ }
5154 }
5255} ;
5356
@@ -100,7 +103,7 @@ const allKeywords = keywordLocations(compiled.ast);
100103const notCovered = allKeywords . filter ( ( location ) => ! visitedLocations . has ( location ) ) ;
101104console . log ( "NOT Covered:" , notCovered . length , "of" , allKeywords . length , ) ;
102105
103- const maxNotCovered = 10 ;
106+ const maxNotCovered = 20 ;
104107const firstNotCovered = notCovered . slice ( 0 , maxNotCovered ) ;
105108if ( notCovered . length > maxNotCovered ) firstNotCovered . push ( "..." ) ;
106109console . log ( firstNotCovered ) ;
0 commit comments