pestphp / pestphp/pest

[4.x] Coverage class printing

Open
#1,337 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
11.7k
Forks
538
Avg merge
4d 11h
Merged PRs (30d)
8

Description

What Happened

Hello,

is it possible remove the output for every class on the coverage option if you add a --no-class-output option to the coverage command or maybe the other coverage options (for example --coverage-html) removes the terminal printing on its own because the output will be printed in another file (html in the example case).

The printing for a huge test coverage (20000 tests with almost 2000 classes) is using a lot of time and sometimes the terminal crashes because of the buffered output.

I would provide a PR but I couldn't figure out how PEST is using the options :-(
I would add here:
https://github.com/pestphp/pest/blob/150bb9478d82eeb132d23f8daacc10ea3190037e/src/Plugins/Coverage.php#L146

if ($useOtherOutput) {
    return $exitCode;
}

I don't know if the coverage result printing (without single classes) uses a lot of time. If not maybe this can only be printed instead of every single class and its coverage.

A similar request was discussed for type-coverage here:
https://github.com/pestphp/pest/discussions/1183

How to Reproduce

It is quite hard to reproduce because you need a huge test suite.

Sample Repository

No response

Pest Version

3.7.1

PHP Version

8.3.15

Operation System

Windows

Notes

I'm using Powershell 7 and the new PHPStorm terminal option.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/Plugins/Coverage.php around line 146 and trace how the coverage command handles its output options. Compare the behavior requested for --no-class-output with options such as --coverage-html and the related type-coverage discussion. Done means large coverage runs no longer print every class when the new option or an alternate report format is selected.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
cli, testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.