pestphp / pest

Pest is an elegant PHP testing Framework with a focus on simplicity, meticulously designed to bring back the joy of testing in PHP.
https://pestphp.com
MIT License
9.61k stars 358 forks source link

Coverage results lines sometimes exceeds compared to the other lines #204

Closed khalyomede closed 3 years ago

khalyomede commented 4 years ago

Description

Sometimes the results exceeds in length compared to other results, resulting in visual overflow.

overflowing-result-pest-php

Reproduce the issue

I can't systematically reproduce this, but my guess is that big file path combined with a lot of missing covered line facilitate the bug to appear, but nothing sure as I did not dived into the source code.

Expected behavior

All the lines allign without overflowing results.

owenvoke commented 4 years ago

Hi @khalyomede, thanks for flagging this up.

Looks like this is caused by the way the "dotted line" is generated in the Coverage plugin: https://github.com/pestphp/pest-plugin-coverage/blob/master/src/Coverage.php#L57

So I guess we'd need to allow lengths of more than 70, although that could be an issue as I'm assuming the width of 70 is based on a standard old terminal width of 80.

khalyomede commented 4 years ago

I know that in Javascript, when using nyc for displaying the coverage in the terminal, as the involved lines cells are quite short, the author have used a technique to use ellipsis in the case there is too much lines to cover.

nyc coverage on terminal

Do you think this could be a possible solution, to use ellipsis to avoid the line to go over 70 characters?

owenvoke commented 4 years ago

We probably could, although due to the existing dotted lines I'm not sure if that may cause it to look confusing. @nunomaduro, what is your thought on this?

nunomaduro commented 4 years ago

I think we could add a line bellow?

owenvoke commented 4 years ago

Hmm, what do you mean? Like... split the line numbers into multiple lines?

| --------------------------  72 characters  ------------------------- |
QueueDrivers/FileQueueDriver.php 42, 51, 57, 91, 103, 194 ...... 90.2%
                                 209, 220, 232
nunomaduro commented 4 years ago
| --------------------------  72 characters  ------------------------- |
QueueDrivers/FileQueueDriver.php 42, 51, 57, 91, 103, 194 .........
                                 209, 220, 232 .................... 90.2%
nunomaduro commented 3 years ago

I've no plans on working on this. Feel free to submit a pull request.