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

fix: Exit with code 1 when nyc doesn't know what to do. #1070

Merged
merged 1 commit into from Apr 17, 2019

Conversation

coreyfarrell
Copy link
Member

When nyc is not told to do anything this is an error. We already
printed the help message to stderr, now we exit with code 1 to indicate
that nyc exited without doing anything.

Add a test to cover this edge case and verify that both nyc and nyc --help produce output as expected to stdout and stderr, exit with the
proper code.

@coveralls
Copy link

coveralls commented Apr 17, 2019

Coverage Status

Coverage increased (+0.2%) to 96.643% when pulling 6599f11 on coreyfarrell:unknown-main-command into 0f745ca on istanbuljs:master.

Copy link
Member

@JaKXz JaKXz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense, but I have one note for the tests

test/nyc-integration.js Outdated Show resolved Hide resolved
test/nyc-integration.js Outdated Show resolved Hide resolved
Copy link
Member

@bcoe bcoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a worthwhile fix to me, I'd advocate just using child_process.spawnSync especially given the BUG we're seeing.

test/nyc-integration.js Outdated Show resolved Hide resolved
When nyc is not told to do anything this is an error.  We already
printed the help message to stderr, now we exit with code 1 to indicate
that nyc exited without doing anything.

Add a test to cover this edge case and verify that both `nyc` and `nyc
--help` produce output as expected to stdout and stderr, exit with the
proper code.
@coreyfarrell coreyfarrell merged commit 21fb2c8 into istanbuljs:master Apr 17, 2019
@coreyfarrell coreyfarrell deleted the unknown-main-command branch April 18, 2019 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants