feat: Support `nycRC()` in configuration object
See original GitHub issueI’m toying with programmatically created configurations at @cfware/nyc. This module exports a class with methods implemented as both static factory functions and chainable non-static manipulation functions. The idea is that you could create an nyc.config.js as follows:
'use strict';
module.exports = require('@cfware/nyc')
.fullCoverage()
.include('lib/**')
.exclude('lib/do-not-cover.js')
.settings;
This example has two main benefits over normal declarative config:
.fullCoverage()sets multiple properties (similar totap --100).exclude()does not clear defaults solib/do-not-cover.jsis in addition totestExclude.defaultExcludes.
I’d love to avoid having to explicitly use .settings in my nyc.config.js files. This could be supported if the nyc lib/config-util.js did something like:
if (Symbol.for('nycrc') in config) {
config = config[Symbol.for('nycrc')]
}
In all supported versions of node Symbol.for('nycrc') === Symbol.for('nycrc') so this would allow nyc to pull it’s configuration from config generator objects such as mine. I’ve already verified that adding this code does not break any existing tests.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Node.js Agent for Google Cloud Debug ChangeLog
This version drops support for Node 4, adds the pathResolver configuration option to support debugging files that have ambiguous paths, and adds a...
Read more >@istanbuljs/nyc-config-typescript - npm
Handy default configuration for instrumenting your TypeScript-backed project with test coverage using nyc. First install the dependencies: npm i ...
Read more >parse-server - Gitee
Parse Server is an open source backend that can be deployed to any infrastructure that can run Node.js.
Read more >@google-cloud/speech | Yarn - Package Manager
Please note that this README.md , the samples/README.md , and a variety of configuration files in this repository (including .nycrc and tsconfig.json )...
Read more >CHANGES.md - loopbackio/loopback-datasource-juggler
datasource: copy settings object in constructor (Miroslav Bajtoš) ... feat: Support "type" key in sub-properties (Hage Yaapa).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@coreyfarrell seems reasonable to me 👍; I think what I’ve seen other libraries do is just have the default export be an object with the config (which I think is what we support today if you have an
nycrc.js) – what advantages are there to having atoNYCRC()method?Adding support for
nyc.config.mjsin nyc 15 has incidentally made this possible. Since we have toawaitthe result of the config load it is now possible for configuration generators to be PromiseLike objects, so: