feat(usage): add YARGS_DISABLE_WRAP env variable to disable wrap#2210
Merged
bcoe merged 5 commits intoyargs:mainfrom Jul 18, 2022
Merged
feat(usage): add YARGS_DISABLE_WRAP env variable to disable wrap#2210bcoe merged 5 commits intoyargs:mainfrom
bcoe merged 5 commits intoyargs:mainfrom
Conversation
bcoe
approved these changes
Jul 13, 2022
Contributor
Author
|
@bcoe Seems like I needed to use the shim to be compatible with deno. It should be good now. 👍 |
bcoe
requested changes
Jul 13, 2022
Member
bcoe
left a comment
There was a problem hiding this comment.
Thanks for this contribution, left a suggestion as to how we could potentially keep 100% coverage, and avoid skipping your test.
lib/usage.ts
Outdated
| @@ -164,6 +164,9 @@ export function usage(yargs: YargsInstance, shim: PlatformShim) { | |||
| }; | |||
|
|
|||
| function getWrap() { | |||
Member
There was a problem hiding this comment.
So that we can maintain our coverage #s, I would do this:
this.getWrap = () => {
...
}And then your test can simply be:
const yargs = yargs().wrap(99);
process.env.YARGS_DISABLE_WRAP = 'true';
expect(yargs.getInternalMethods().getUsageInstance().getWrap()).to.equal(null);
bcoe
approved these changes
Jul 18, 2022
Member
|
@jgoux thank you for the contribution. |
This was referenced Sep 6, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #2200
I had to modify the test
should wrap based on window-size if no wrap is providedbecause the actual length of the non-wrapped output is5and not4. 👍