Pass through "file" option to reporters
See original GitHub issueExpected Behavior
I can pass through the “file” option to reporters such as Cobertura in order to specify the report filename.
Observed Behavior
I cannot specify the report filename.
The following lines of code in nyc/index pass through only four options to each reporter:
// nyc/index.js
this.reporter.forEach((_reporter) => {
reports.create(_reporter, {
skipEmpty: this.config.skipEmpty,
skipFull: this.config.skipFull,
projectRoot: this.cwd,
maxCols: process.stdout.columns || 100
}).execute(context)
})
However, the reporters are configured to expect potentially more options than these. Here is an example from Cobertura:
// cobertura.index
constructor(opts) {
super();
this.cw = null;
this.xml = null;
this.projectRoot = opts.projectRoot || process.cwd();
this.file = opts.file || 'cobertura-coverage.xml';
}
As you can see, the capability to specify the filename is already present via the option “file.” However, there is no way to pass it through. I would expect it to look something like this:
// nyc/index.js
this.reporter.forEach((_reporter) => {
reports.create(_reporter, {
skipEmpty: this.config.skipEmpty,
skipFull: this.config.skipFull,
projectRoot: this.cwd,
maxCols: process.stdout.columns || 100,
file: this.config.reportFilename <-- added line here
}).execute(context)
})
Environment Information
System:
OS: Windows 10 10.0.18362
CPU: (8) x64 Intel(R) Core(TM) i7 CPU 880 @ 3.07GHz
Memory: 7.40 GB / 15.96 GB
Binaries:
Node: 12.14.0 - C:\Program Files\nodejs\node.EXE
npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD
npmPackages:
nyc: ^15.0.0 => 15.0.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5
Top Results From Across the Web
Catch2/reporters.md at devel - GitHub
Reporters are a customization point for most of Catch2's output, e.g. formatting and writing out assertions (whether passing or failing), sections, test cases, ......
Read more >Chef InSpec Reporters - Chef Documentation
Chef InSpec allows you to output your test results to one or more reporters. Configure the reporter(s) using either the --reporter option or...
Read more >Content Scanning in File Reporter - YouTube
File Reporter provides the ability to scan file content with user-defined or custom pattern matching. Furthermore, it can automatically ...
Read more >Reporters | Cypress Documentation
Some reporters accept options that customize their behavior. These can be specified in your Cypress configuration or via command line options. Reporter options...
Read more >Reporter | Testomatio
Setting Report Title. Give a title to your reports by passing it as environment variable to TESTOMATIO_TITLE . TESTOMATIO={ ...
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 FreeTop 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
Top GitHub Comments
As it turns out, it’s not too hard to replicate what
nyc report
does in a script of your own and pass through the options you want. Here’s my script to get statement coverage with the html-spa reporter, @miyasudokoro presumably you could do something similar for the cobertura reporter and thefile
option.(This is in TypeScript, you’ll have to compile to JS or run with
ts-node
to use it.)I would love it if the entire configuration (
this.config
) was passed to the reporter.