@@ -11,6 +11,7 @@ import { projectPaths, writeJson } from '../lib/core.mjs';
1111const testDir = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
1212const engineRoot = path . resolve ( testDir , '..' ) ;
1313const repositoryRoot = path . resolve ( engineRoot , '..' , '..' ) ;
14+ const misspelledBoolean = [ 'Bole' , 'an' ] . join ( '' ) ;
1415
1516function fixture ( ) {
1617 const root = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'docgen-git-inventory-' ) ) ;
@@ -66,12 +67,14 @@ test('installed launcher indexes a real Git repository', () => {
6667 encoding : 'utf8' ,
6768 env : { ...process . env , DOCGEN_PROGRESS : '0' }
6869 } ) ;
70+ const combinedOutput = `${ run . stdout } \n${ run . stderr } ` ;
6971 assert . equal ( run . status , 0 , `INDEX STDERR:\n${ run . stderr } \nINDEX STDOUT:\n${ run . stdout } ` ) ;
70- assert . doesNotMatch ( `${ run . stdout } \n ${ run . stderr } ` , / B o l e a n i s n o t d e f i n e d / ) ;
72+ assert ( ! combinedOutput . includes ( `${ misspelledBoolean } is not defined` ) ) ;
7173 assert ( fs . existsSync ( path . join ( root , '.docgen' , 'index' , 'semantic.db' ) ) ) ;
7274} ) ;
7375
7476test ( 'shipped JavaScript contains no misspelled Boolean global' , ( ) => {
77+ const pattern = new RegExp ( `\\b${ misspelledBoolean } \\b` ) ;
7578 const stack = [ engineRoot ] ;
7679 const offenders = [ ] ;
7780 while ( stack . length ) {
@@ -80,7 +83,7 @@ test('shipped JavaScript contains no misspelled Boolean global', () => {
8083 if ( [ 'node_modules' , '.git' ] . includes ( entry . name ) ) continue ;
8184 const file = path . join ( dir , entry . name ) ;
8285 if ( entry . isDirectory ( ) ) stack . push ( file ) ;
83- else if ( / \. (?: m j s | j s | c j s ) $ / . test ( entry . name ) && / \b B o l e a n \b / . test ( fs . readFileSync ( file , 'utf8' ) ) ) {
86+ else if ( / \. (?: m j s | j s | c j s ) $ / . test ( entry . name ) && pattern . test ( fs . readFileSync ( file , 'utf8' ) ) ) {
8487 offenders . push ( path . relative ( engineRoot , file ) ) ;
8588 }
8689 }
0 commit comments