Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't override package.json reporters via CLI #379

Closed
gustavohenke opened this issue Sep 4, 2016 · 7 comments
Closed

Can't override package.json reporters via CLI #379

gustavohenke opened this issue Sep 4, 2016 · 7 comments
Labels

Comments

@gustavohenke
Copy link

gustavohenke commented Sep 4, 2016

Expected Behavior

Override reporter configuration in package.json via CLI --reporter argument.

Observed Behavior

The CLI argument --reporter doesn't work when there's something under nyc's reporter key in package.json.

Code (or Repository) that Reproduces Issue

gustavohenke/mockbase@21487a9

I just started the project and haven't decided how to document it yet, so...

npm install
npm test
nyc report --reporter=text-lcov

Forensic Information

Operating System:
Windows 10

Environment Information:

λ node --version
v6.4.0

λ npm --version
3.10.6
@gustavohenke
Copy link
Author

To keep the issue template clean, I forgot to add one thing: thanks for such amazing tool!
Much better than doing various hacks to get some coverage out of mocha tests.

@bcoe bcoe added the bug label Sep 7, 2016
@bcoe
Copy link
Member

bcoe commented Sep 7, 2016

@gustavohenke I agree that --reporter should take precedence over the reporter in package.json.

@edmundito
Copy link

edmundito commented Sep 8, 2016

I just ran into the same issue as well. Another thing I noticed is that if you have this in your configuration:

"reporter": []

Then nyc report does not do anything.

@trainerbill
Copy link

Yeah this really bit me when using coveralls:

"coverage": "nyc report --reporter=text-lcov | coveralls",

having reporters specified in the package.json overrides the coverage script and you get an ugly error everytime on travis:

image

looks like nyc report --reporter=text-lcov is passing in the summary and not the lcov. removing reporters from package.json -> nyc -> reporters solved the problem.

@bcoe
Copy link
Member

bcoe commented Sep 13, 2016

@trainerbill see #388 would love the extra eyes.

bcoe added a commit that referenced this issue Sep 13, 2016
* feat: refactored config to fix precedence of config vs. args see #379

* fix: address standard nits

* fix: remove cruft from package.json

* fix: address @mourner's code review
bcoe added a commit that referenced this issue Sep 13, 2016
…ment (#389)

* feat: refactored config to fix precedence of config vs. args see #379

* fix: address standard nits

* fix: remove cruft from package.json

* fix: upgrade to newer versions of source-map, signal-exit, and instrument (somewhat frightening)
@bcoe
Copy link
Member

bcoe commented Oct 1, 2016

@gustavohenke this is now deployed \o/

@bcoe bcoe closed this as completed Oct 1, 2016
@gustavohenke
Copy link
Author

Yay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants