Skip to content

Instantly share code, notes, and snippets.

@aduth
Created January 30, 2019 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aduth/8981b2ff1eb7db1e41b9a15f4843cbe5 to your computer and use it in GitHub Desktop.
Save aduth/8981b2ff1eb7db1e41b9a15f4843cbe5 to your computer and use it in GitHub Desktop.
/* eslint-disable no-console */
const { readFileSync, statSync } = require( 'fs' );
const glob = require( 'glob' );
const entries = readFileSync( './CODEOWNERS', 'utf-8' )
.split( '\n' )
.filter( ( line ) => line && ! line.startsWith( '#' ) )
.map( ( entry ) => entry.split( ' ' )[ 0 ] )
.filter( ( entry ) => entry !== '*' );
const packages = glob.sync( './packages/*' )
.filter( ( path ) => statSync( path ).isDirectory() )
.map( ( path ) => path.replace( /^\./, '' ) );
let hasCoverage = true;
packages.forEach( ( path ) => {
if ( ! entries.includes( path ) ) {
console.log( `Missing coverage for ${ path }` );
hasCoverage = false;
}
} );
if ( hasCoverage ) {
console.log( 'All packages covered!' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment