1- import '../common/index.mjs' ;
1+ import * as common from '../common/index.mjs' ;
22
33import assert from 'node:assert' ;
44import { existsSync } from 'node:fs' ;
@@ -8,6 +8,10 @@ import path from 'node:path';
88// This tests that `make doc` generates the JSON documentation properly.
99// Note that for this test to pass, `make doc` must be run first.
1010
11+ if ( common . isWindows ) {
12+ common . skip ( '`make doc` does not run on Windows' ) ;
13+ }
14+
1115function validateModule ( module ) {
1216 assert . strictEqual ( typeof module , 'object' ) ;
1317 assert . strictEqual ( module . type , 'module' ) ;
@@ -120,7 +124,14 @@ for await (const dirent of await fs.opendir(new URL('../../out/doc/api/', import
120124 }
121125
122126 console . log ( 'testing' , jsonPath , 'based on' , expectedSource ) ;
123- const json = JSON . parse ( await fs . readFile ( jsonPath , 'utf8' ) ) ;
127+
128+ const fileContent = await fs . readFile ( jsonPath , 'utf8' ) ;
129+ // A proxy to check if the file is human readable is to count if it contains
130+ // at least 3 line return.
131+ assert . strictEqual ( fileContent . split ( '\n' , 3 ) . length , 3 ) ;
132+ assert . ok ( fileContent . endsWith ( '\n' ) , 'EOL at EOF' ) ;
133+
134+ const json = JSON . parse ( fileContent ) ;
124135
125136 assert . strictEqual ( json . type , 'module' ) ;
126137 assert . strictEqual ( json . source , expectedSource ) ;
0 commit comments