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

`nyc report html` should maybe tell users that it’s not what they want? #401

Closed
addaleax opened this issue Sep 22, 2016 · 1 comment · Fixed by #1100

Comments

@addaleax
Copy link
Member

commented Sep 22, 2016

Okay, probably it’s just me having trained myself to use istanbul report over a long time, but I tend to always write nyc report html and am confused by the result that there is no actual HTML output.
I’ve begun to catch up always correcting to -r html, but maybe other people who transition to nyc would find it helpful if nyc report outputs a warning when it receives at least one positional argument?

What do you think?

@bcoe bcoe added the enhancement label May 14, 2017

@stale stale bot added the wontfix label Jan 6, 2019

@istanbuljs istanbuljs deleted a comment from stale bot Mar 7, 2019

@coreyfarrell coreyfarrell removed the wontfix label Mar 7, 2019

@coreyfarrell

This comment has been minimized.

Copy link
Member

commented Mar 7, 2019

@bcoe Adding .strict() to the report command builder fails with Unknown argument: exclude (I think due to the config in package.json). I removed global: false from the exclude option in config-util.js then added .hide('exclude') to the report command builder. This got around the unknown argument error, but then I didn't get any error for nyc report html. Is this a bug in yargs? The documentation for .strict() says Unrecognized commands will also be reported as errors. I was able to get the desired results by using .strict().demandCommand(0, 0).

I think I can make this work but it'll have to wait for some of the work from @AndrewFinlay to be merged. I'll try to get this into nyc@14 but I can't promise.

@coreyfarrell coreyfarrell self-assigned this Mar 7, 2019

@stale stale bot added the stale label May 6, 2019

@istanbuljs istanbuljs deleted a comment from stale bot May 6, 2019

@stale stale bot removed the stale label May 6, 2019

@JaKXz JaKXz added pinned stale labels May 6, 2019

@stale stale bot removed the stale label May 6, 2019

coreyfarrell added a commit to coreyfarrell/nyc that referenced this issue May 6, 2019
fix: Report error if unwanted positional arguments are received
This applies to check-coverage, instrument, merge and report.  Passing
additional arguments will now cause the help script to be displayed and
an error exit code.

Unknown flags `nyc report --unknown=1` are still not reported.
Reporting unknown flags would require additional work as
`yargs.strict()` causes unknown items from configuration to be reported,
including flags that are defined for the global command but not a
sub-command.

Fixes istanbuljs#401
coreyfarrell added a commit to coreyfarrell/nyc that referenced this issue May 9, 2019
fix(cli): Report error if unwanted positional arguments are received
This applies to check-coverage, instrument, merge and report.  Passing
additional arguments will now cause the help script to be displayed and
an error exit code.

Unknown flags `nyc report --unknown=1` are still not reported.
Reporting unknown flags would require additional work as
`yargs.strict()` causes unknown items from configuration to be reported,
including flags that are defined for the global command but not a
sub-command.

Fixes istanbuljs#401
coreyfarrell added a commit to coreyfarrell/nyc that referenced this issue May 9, 2019
fix(cli): Report error if unwanted positional arguments are received
This applies to check-coverage, instrument, merge and report.  Passing
additional arguments will now cause the help script to be displayed and
an error exit code.

Unknown flags `nyc report --unknown=1` are still not reported.
Reporting unknown flags would require additional work as
`yargs.strict()` causes unknown items from configuration to be reported,
including flags that are defined for the global command but not a
sub-command.

Fixes istanbuljs#401
coreyfarrell added a commit that referenced this issue May 9, 2019
fix(cli): Report error if unwanted positional arguments are received (#…
…1100)

This applies to check-coverage, instrument, merge and report.  Passing
additional arguments will now cause the help script to be displayed and
an error exit code.

Unknown flags `nyc report --unknown=1` are still not reported.
Reporting unknown flags would require additional work as
`yargs.strict()` causes unknown items from configuration to be reported,
including flags that are defined for the global command but not a
sub-command.

Fixes #401
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.