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

Disable line wrapping during scenario tests #784

Merged
merged 1 commit into from
Jan 4, 2024
Merged

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Jan 4, 2024

Adds support for a PUFFIN_NO_WRAP environment variable which disables line wrapping in miette output.

We set this variable in the scenario tests to improve the readability of snapshots.

I contributed the ability to disable line wrapping upstream at zkat/miette#328

Cargo.toml Outdated Show resolved Hide resolved
@zanieb zanieb force-pushed the zb/disable-line-wrap branch from 54ec6b5 to e991f2c Compare January 4, 2024 17:04
@zanieb zanieb marked this pull request as ready for review January 4, 2024 17:19
.current_dir(&temp_dir), @r###"
success: false
exit_code: 1
----- stdout -----

----- stderr -----
× No solution found when resolving dependencies:
╰─▶ Because there is no version of
a
Copy link
Member

Choose a reason for hiding this comment

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

I know it sounds difficult, but... is there any way we could instead strip the prefix when we generate the error message, so that it's wrapped appropriately to start? Right now, we it feels like we're applying one fixup on top of another rather than solving the problem at the source.

Copy link
Member Author

@zanieb zanieb Jan 4, 2024

Choose a reason for hiding this comment

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

I don't think that's worth the complexity. It'd definitely be much more of a hack.

I think disabling the line wrapping during tests is desirable separately from the long package names — the line wrapping is generally confusing at 80 characters when reading our error messages in snapshots. Perhaps in the long run, we should focus on improving that formatting such that wrapped messages are easier to read. I think this is the simplest path forward for now and I think I'd want to be able to disable line wrapping in output as a user anyway.

@zanieb
Copy link
Member Author

zanieb commented Jan 4, 2024

Note the pull request was already accepted / merged upstream.

@zanieb zanieb force-pushed the zb/disable-line-wrap branch 2 times, most recently from e3de6cf to 463f125 Compare January 4, 2024 18:57
@zanieb zanieb force-pushed the zb/disable-line-wrap branch from 463f125 to d68c88b Compare January 4, 2024 19:00
@zanieb zanieb enabled auto-merge (squash) January 4, 2024 19:04
@zanieb zanieb merged commit 5e04a95 into main Jan 4, 2024
3 checks passed
@zanieb zanieb deleted the zb/disable-line-wrap branch January 4, 2024 19:07
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