pest icon indicating copy to clipboard operation
pest copied to clipboard

[Bug]: --columns isn't doing anything with --compact, and broken with --parallel

Open oprypkhantc opened this issue 1 year ago • 3 comments

What Happened

When you use pest --compact --columns=20, progress is being reported as dots, and I expect it to report 20 dots in a line, then a percentage overall progress, similar to how both phpunit and paratest do it out-of-the-box. Instead, dots are just being reported till the very end of the line and percentage progress is never reported anywhere.

Using pest --parallel forces the --compact look, but trying to use --columns=20 --parallel results in a The "--columns" option does not exist. error. The columns in of themsevles aren't an issue, it's that it's impossible to tell the actual progress.

We currently have 18k tests and these take a while to run, so having a progress is quite criticial.

As a side issue, there's no way to use the default pest printer in a non-compact mode with --parallel. If this is considered a bug, I'll report this as a separate issue.

How to Reproduce

Use pest --compact --columns=20 or pest --parallel with at least a 100 tests.

Sample Repository

No response

Pest Version

2.25.0

PHP Version

8.2.12

Operation System

Linux

Notes

> docker compose exec app ./vendor/bin/pest --compact modules/Users

  ..............................................................⨯⨯⨯⨯..⨯⨯⨯⨯⨯⨯.........................................................................................................⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯..................
  ............................^C

> docker compose exec app ./vendor/bin/pest --compact --columns=10 modules/Users

   WARN  Less than 16 columns requested, number of columns set to 16

  ..............................................................⨯⨯⨯⨯..⨯⨯⨯⨯⨯⨯.........................................................................................................⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯..................
  ..........................^C

> docker compose exec app ./vendor/bin/pest --compact --columns=17 modules/Users

  ..............................................................⨯⨯⨯⨯..⨯⨯⨯⨯⨯⨯.........................................................................................................⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯⨯..................
  ..........................c...........^C


> docker compose exec app ./vendor/bin/pest --parallel --columns=17 modules/Users

                                          
  The "--columns" option does not exist.  
                                          

oprypkhantc avatar Nov 23 '23 15:11 oprypkhantc

At the same time, somehow columns are automatically detected on CI (which natively runs Linux, but it also runs inside a Docker container) and do work. Percentage progress is still missing though.

oprypkhantc avatar Nov 23 '23 16:11 oprypkhantc

I noticed the missing of the default completion % when migrating to Pest too, its really more useful when your tests takes almost an hour to complete than thousands of " . " only.

I would love to have a progressbar instead and do tried to implement, but could not find a way to override the needed classes.

leonardoldr23 avatar Dec 22 '23 18:12 leonardoldr23

Also having an issue with --columns in Docker (though without parallel tests interestingly). I have a simple bash script for running the tests, and this is what I added as a workaround:

- docker-compose exec -T test vendor/bin/pest "$@"
+ docker-compose exec -e COLUMNS=$(tput cols) -T test vendor/bin/pest "$@"

The COLUMNS env var does work for me, but --columns doesn't, so this passes the (outer) terminal width to pest within docker via an env var.

Edit: After some more testing, --columns/--columns max doesn't seem to work in CI (GitHub Actions) for me either. Locally setting COLUMNS= works fine even with --compact. Tested that on CI and it works the same.

One more semi-related thing I haven't been able to get to work is --no-progress. Doesn't seem to do anything locally (in Docker) or on CI for me.

stancl avatar Feb 08 '24 02:02 stancl