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

Do not limit number of columns to 80 on non-interactive TTY #5526

Closed
borys-p opened this issue Sep 26, 2023 · 1 comment
Closed

Do not limit number of columns to 80 on non-interactive TTY #5526

borys-p opened this issue Sep 26, 2023 · 1 comment
Assignees
Labels
feature/test-runner CLI test runner version/10 Something affects PHPUnit 10
Milestone

Comments

@borys-p
Copy link

borys-p commented Sep 26, 2023

Q A
PHPUnit version 10.3.5
PHP version 8.2.8
Installation Method Composer

Summary

I'm upgrading to version 10 and ran across a relatively minor, but still valid issue. We're running unit tests in a Docker container, in Jenkins, which is not allocating a TTY. This causes phpUnit to revert to the default width of 80 columns, even though we can safely display >200 in our environment.

Current behavior

phpUnit assumes that a non-interactive TTY always has a width of 80 columns, even though this is rarely the case nowadays. In our case we could safely increase that number to over 200 columns and with a few thousand tests our current output is unnecessarily long.

How to reproduce

Define columns="200" in phpunit.xml and run the tests inside a non-TTY environment (e.g., docker exec container-name phpunit). You will notice that the output width is limited to just 80 characters, as Console::isInteractive() returns 80.

Expected behavior

The ability to define the maximum console width, with 80 being the default. Ideally, via a configuration setting, but it could be also a property that can be changed by an extension.

I can see a possible workaround by leveraging the loadFrom() method that does not override the values, but that's just an ugly hack, not addressing the actual issue.

@borys-p borys-p added type/bug Something is broken version/10 Something affects PHPUnit 10 labels Sep 26, 2023
@sebastianbergmann sebastianbergmann added the feature/test-runner CLI test runner label Sep 27, 2023
@sebastianbergmann sebastianbergmann changed the title The default number of columns can't be changed Do not limit number of columns to 80 on non-interactive TTY Sep 27, 2023
@sebastianbergmann sebastianbergmann self-assigned this Sep 27, 2023
@sebastianbergmann sebastianbergmann removed the type/bug Something is broken label Sep 27, 2023
@sebastianbergmann sebastianbergmann added this to the PHPUnit 10.4 milestone Sep 27, 2023
@borys-p
Copy link
Author

borys-p commented Sep 27, 2023

Amazing, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/test-runner CLI test runner version/10 Something affects PHPUnit 10
Projects
None yet
Development

No branches or pull requests

2 participants