code-coverage
code-coverage copied to clipboard
support CJS configs in ES packages
Problem statement
When writing an application with "type": "module" in package.json, it becomes impossible to set the NYC config with JS, since it only supports the .js extension and it only supports CommonJS. As a result, any configuration in nyc.config.js will fail for trying to require an ES module.
This PR adds support for nyc.config.cjs, allowing packages with "type": "module" to still configure a nyc.config.cjs file for a CommonJS configuration.