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

Require one argument for optional parameters #229

Closed
wants to merge 1 commit into from
Closed

Conversation

josebolos
Copy link
Contributor

When an optional parameter like -p that requires an argument is used but an argument is not passed, this will cause the app to fail as expected instead of using a random value. For example, port was being set to 3000 instead of the default 5401.

This hopefully addresses #145.

When an optional parameter like `-p` that requires an argument is used but an argument is not passed, this will cause the app to fail as expected instead of using a random value. For example, port was being set to 3000 instead of the default 5401.

This hopefully addresses #145.
Copy link
Contributor

@jpw jpw left a comment

Choose a reason for hiding this comment

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

Tests plz, soz.

@josebolos
Copy link
Contributor Author

@jpw I'm unsure of what needs to be tested here. The processing of the arguments is done by yargs, which in theory we should trust as being already proven to be working by its authors, and in fact that's the case for every other command line argument that we accept.

If we want to start testing that all the CLI arguments are working as expected, then we need to find something that allows us to test that. I don't even know what that would be, it's definitely not unit testing. Something that could start shunter and finding a way of outputting the results of all the CLI arguments, which shunter doesn't even have at the moment. So that would be a new feature to be added to shunter.

Is this worth it, considering the scope of this PR? I'm not aware of any other of our apps running these kind of tests.

@jpw
Copy link
Contributor

jpw commented Jul 9, 2018

Thanks for having a look! Similar tests can be seen in https://github.com/springernature/shunter/blob/master/tests/server/core/worker.js ;)

While adding nargs params looks like a Good Thing, does it actually fix the original issue?

@josebolos josebolos closed this Jan 21, 2020
@josebolos josebolos deleted the port branch January 21, 2020 17:12
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.

2 participants