@@ -77,7 +77,6 @@ function findAllKeys(obj, allKeys = new Set()) {
7777
7878const allExpectedKeys = new Set ( [
7979 'added' ,
80- 'api' ,
8180 'changes' ,
8281 'classes' ,
8382 'classMethods' ,
@@ -97,8 +96,8 @@ const allExpectedKeys = new Set([
9796 'miscs' ,
9897 'modules' ,
9998 'name' ,
100- 'optional' ,
10199 'napiVersion' ,
100+ 'optional' ,
102101 'options' ,
103102 'params' ,
104103 'pr-url' ,
@@ -128,18 +127,18 @@ for await (const dirent of await fs.opendir(new URL('../../out/doc/api/', import
128127 console . log ( 'testing' , jsonPath , 'based on' , expectedSource ) ;
129128
130129 const fileContent = await fs . readFile ( jsonPath , 'utf8' ) ;
130+ // A proxy to check if the file is human readable is to count if it contains
131+ // at least 3 line return.
132+ assert . strictEqual ( fileContent . split ( '\n' , 3 ) . length , 3 ) ;
131133
132134 const json = JSON . parse ( fileContent ) ;
133135
134136 assert . strictEqual ( json . type , 'module' ) ;
135137 assert . strictEqual ( json . source , expectedSource ) ;
136-
137138 if ( dirent . name !== 'index.md' ) {
138139 assert . ok ( json . introduced_in || Object . values ( json ) . at ( - 1 ) ?. [ 0 ] . introduced_in ) ;
139- assert . partialDeepStrictEqual ( allExpectedKeys , findAllKeys ( json ) ) ;
140140 }
141-
142- assert . deepStrictEqual ( Object . keys ( json ) . sort ( ) , [ 'type' , 'api' , 'source' , ...( {
141+ assert . deepStrictEqual ( Object . keys ( json ) , [ 'type' , 'source' , ...( {
143142 'addons.md' : [ 'introduced_in' , 'miscs' ] ,
144143 'cli.md' : [ 'introduced_in' , 'miscs' ] ,
145144 'debugger.md' : [ 'introduced_in' , 'stability' , 'stabilityText' , 'miscs' ] ,
@@ -148,6 +147,7 @@ for await (const dirent of await fs.opendir(new URL('../../out/doc/api/', import
148147 'errors.md' : [ 'introduced_in' , 'classes' , 'miscs' ] ,
149148 'esm.md' : [ 'introduced_in' , 'meta' , 'stability' , 'stabilityText' , 'properties' , 'miscs' ] ,
150149 'globals.md' : [ 'introduced_in' , 'stability' , 'stabilityText' , 'classes' , 'methods' , 'miscs' ] ,
150+ 'index.md' : [ ] ,
151151 'intl.md' : [ 'introduced_in' , 'miscs' ] ,
152152 'n-api.md' : [ 'introduced_in' , 'stability' , 'stabilityText' , 'miscs' ] ,
153153 'packages.md' : [ 'introduced_in' , 'meta' , 'miscs' ] ,
0 commit comments