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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(usage): add YARGS_DISABLE_WRAP env variable to disable wrap #2210

Merged
merged 5 commits into from Jul 18, 2022

Conversation

jgoux
Copy link
Contributor

@jgoux jgoux commented Jul 10, 2022

Resolves #2200

I had to modify the test should wrap based on window-size if no wrap is provided because the actual length of the non-wrapped output is 5 and not 4. 馃憤

@jgoux
Copy link
Contributor Author

jgoux commented Jul 13, 2022

@bcoe Seems like I needed to use the shim to be compatible with deno. It should be good now. 馃憤

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.

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() {
Copy link
Member

Choose a reason for hiding this comment

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

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);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made the changes 馃憤

@bcoe bcoe merged commit b680ace into yargs:main Jul 18, 2022
@bcoe
Copy link
Member

bcoe commented Jul 18, 2022

@jgoux thank you for the contribution.

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.

Provide an environment variable to disable columns wrapping
2 participants