checkModules.js: Run as part of CI

* Add to npm run test, and exit with error code
* Improve output message, with instructions on
  how to add to ignore list.

Change-Id: Id4ed56673e84073ac06468bdc429c138466e2501
This commit is contained in:
Ed Sanders 2024-05-09 11:07:37 +01:00
parent fc9c8bed20
commit 2eafc3ddc2
2 changed files with 8 additions and 3 deletions

View file

@ -78,8 +78,13 @@ function checkFiles() {
} );
if ( missingFiles.length ) {
console.log( missingFiles.length + ' missing file(s):' );
console.log( missingFiles.join( '\n' ) );
console.error(
`${ missingFiles.length } file(s) from lib/ve/modules.json are missing from extension.json:\n\n` +
missingFiles.map( ( file ) => `* ${ file }\n` ).join( '' ) +
'\nIf any of these files are not required, add them to the ignore list in build/checkModules.js.'
);
// eslint-disable-next-line n/no-process-exit
process.exit( 1 );
} else {
console.log( 'No missing files.' );
}

View file

@ -7,7 +7,7 @@
"eslint": "eslint --cache --ext .js,.json .",
"eslint-fix": "eslint --cache --ext .js,.json --fix .",
"api-testing": "mocha --timeout 0 --parallel --recursive tests/api-testing",
"test": "grunt test",
"test": "grunt test && node build/checkModules.js",
"doc": "jsdoc -c .jsdoc.json",
"screenshots-all": "grunt screenshots-all",
"selenium-daily": "npm run selenium-test -- --mochaOpts.grep @daily",