chore: move .mocharc.js to root and delete library copies#8069
chore: move .mocharc.js to root and delete library copies#8069GautamSharda wants to merge 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request centralizes Mocha configuration by removing local .mocharc files across the monorepo and updating the root configuration. Feedback highlights that switching to ESM exports in the root .mocharc.js could cause runtime errors in CommonJS environments. Furthermore, the reviewer pointed out that the omission of the recursive flag in the centralized config might lead to silent test skips, as several deleted local configurations previously relied on it for test discovery.
| config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; | ||
| } | ||
| module.exports = config | ||
| export default config |
There was a problem hiding this comment.
Changing the export to export default in a .js file will cause a SyntaxError at runtime if the root package.json does not contain "type": "module". Since this configuration is being centralized to replace local versions that were using CommonJS (module.exports), it is safer to maintain CommonJS compatibility to ensure it works across all packages in the monorepo.
Additionally, please ensure that the config object (defined in the lines above) includes "recursive": true. Several of the deleted local configurations (e.g., in gapic-node-processing, grafeas, and google-cloud-monitoring) specifically enabled this flag. If it is missing from this centralized root configuration, Mocha will fail to discover tests in subdirectories for those packages, leading to silent test skips in CI.
| export default config | |
| module.exports = config |
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
For googleapis/librarian#4583