pestphp / pestphp/pest

[4.x] Type coverage reports 100% when number of problems is small in a large codebase

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

Nobody has claimed this yet.

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

Description

What Happened

When running ./vendor/bin/pest --type-coverage --compact in a large codebase the output can report 100% even if there is an error.

This looks like a rounding error where type coverage is less than 0.05%. Rounding makes sense at lower values but ideally it should only report 100% if there are no problems at all.

Image

This is a Papercut though. If I run with --min=100 the error is found and a failure is reported as 99.9% coverage :)

How to Reproduce

In a large codebase with no type coverage errors introduce a single error and run --type-coverage --compact

Sample Repository

No response

Pest Version

3.8.2

PHP Version

8.4.11

Operation System

Windows

Notes

Using Laravel Herd

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 by running ./vendor/bin/pest --type-coverage --compact in a large codebase with one introduced type-coverage error, using Pest 3.8.2 and PHP 8.4.11 if possible. Trace how the compact type-coverage percentage is calculated and identify the output path involved. Done means the compact report does not claim 100% when any problem exists, while --min=100 still reports failure correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
testing
Issue type
Bug
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.