PHPackages                             schenke-io/test-output-formatter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. schenke-io/test-output-formatter

ActivePhpstan-extension[Testing &amp; Quality](/categories/testing)

schenke-io/test-output-formatter
================================

Isolates failing test files and under-coverage classes for rapid triage.

v0.0.4(1mo ago)0148↓87.5%2MITPHPPHP ^8.3CI passing

Since Jun 6Pushed 1mo agoCompare

[ Source](https://github.com/schenke-io/test-output-formatter)[ Packagist](https://packagist.org/packages/schenke-io/test-output-formatter)[ RSS](/packages/schenke-io-test-output-formatter/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (14)Versions (5)Used By (2)

[![Version](https://camo.githubusercontent.com/50061b5cd3e455188b62f0c509a3576599cb5b29de197dafd8d71d438ebd8ee4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736368656e6b652d696f2f746573742d6f75747075742d666f726d61747465723f7374796c653d666c6174)](https://packagist.org/packages/schenke-io/test-output-formatter)[![Downloads](https://camo.githubusercontent.com/2579e80009dbeca77dd1bba7b6bf09d87ebccf29b838969310633fe411a98e01/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736368656e6b652d696f2f746573742d6f75747075742d666f726d61747465723f7374796c653d666c6174)](https://packagist.org/packages/schenke-io/test-output-formatter)[![Tests](https://github.com/schenke-io/test-output-formatter/actions/workflows/tests.yml/badge.svg)](https://github.com/schenke-io/test-output-formatter/actions/workflows/tests.yml)[![License](https://camo.githubusercontent.com/05cb489cae40d7e2eefa18d27d0e7a56d812c7a2cd098a721b60c168b032527f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f736368656e6b652d696f2f746573742d6f75747075742d666f726d61747465723f7374796c653d666c6174)](https://github.com/schenke-io/test-output-formatter/blob/main/LICENSE.md)[![PHP](https://camo.githubusercontent.com/aaa74c2ce95b58deb9f07726a235f5e4a0ffc33176e8957cadce6a088a23d60f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f736368656e6b652d696f2f746573742d6f75747075742d666f726d61747465723f7374796c653d666c6174)](https://packagist.org/packages/schenke-io/test-output-formatter)

Test Output Formatter
======================================================================

[](#test-output-formatter)

[![](resources/img/package-image.svg)](resources/img/package-image.svg)

Isolates failing test files and under-coverage classes for rapid triage. ### Benefits for AI and Triage

[](#benefits-for-ai-and-triage)

- **Token Efficiency**: Minimizes output to only what's necessary, saving tokens and reducing noise in AI-driven workflows.
- **Rapid Triage**: Focuses attention on the 1% of files that actually need fixing, speeding up the development cycle.

- [Test Output Formatter](#test-output-formatter)
    - [Benefits for AI and Triage](#benefits-for-ai-and-triage)
    - [Installation](#installation)
        - [Auto-Registration](#auto-registration)
    - [Features](#features)
        - [PHPStan](#phpstan)
        - [Pest](#pest)
- [Test Output Formatter Skill](#test-output-formatter-skill)
    - [Pest Plugin Flags](#pest-plugin-flags)
        - [`--format=json`](#format-json)
        - [`--cache-dir=`](#cache-dir-dir)
        - [`--rerun-failures`](#rerun-failures)
        - [`--changed`](#changed)
        - [`--since=`](#since-ref)
        - [`--under=`](#under-percentage)
        - [`--slowest=`](#slowest-count)
        - [`--over=`](#over-ms)
    - [PHPStan Error Formatters](#phpstan-error-formatters)
    - [AI Agent Integration](#ai-agent-integration)
        - [ErrorFormatter](#errorformatter)
            - [Public methods of ErrorFormatter](#public-methods-of-errorformatter)
        - [CompactErrorFormatter](#compacterrorformatter)
            - [Public methods of CompactErrorFormatter](#public-methods-of-compacterrorformatter)
        - [JsonErrorFormatter](#jsonerrorformatter)
            - [Public methods of JsonErrorFormatter](#public-methods-of-jsonerrorformatter)

Installation
----------------------------------------------------

[](#installation)

```
composer require --dev schenke-io/test-output-formatter
```

### Auto-Registration

[](#auto-registration)

The package uses standard discovery mechanisms to integrate with your tools:

- **PHPStan**: The extension is automatically registered via the `phpstan-extension` type in `composer.json` and the `extension.neon` file. For this to work seamlessly, it is highly recommended to install the extension installer:

```
composer require --dev phpstan/extension-installer
```

- **Pest**: The plugin is automatically registered through the `extra.pest.plugins` configuration in `composer.json`. No additional configuration is required.

Features
--------------------------------------------

[](#features)

### PHPStan

[](#phpstan)

- **Error Formatter**: Output only file paths with errors for quick consumption by other tools.
- **Usage**:
    - **File paths only**: ```
        vendor/bin/phpstan analyse --error-format=testOutput
        ```
    - **Compact format**: (file:line message) ```
        vendor/bin/phpstan analyse --error-format=testOutputCompact
        ```
    - **JSON format**: ```
        vendor/bin/phpstan analyse --error-format=testOutputJson
        ```

### Pest

[](#pest)

- **Integration**: Plugin to assist in isolating failing tests and checking coverage.
- **Usage**:
    - **Failures only**: Just gives you the list of failing test files. ```
        vendor/bin/pest --parallel --failed-files-only
        ```
    - **Coverage check**: Reports classes with line coverage below the specified threshold. ```
        vendor/bin/pest --parallel --under=80
        ```
    - **Slow tests**: Identifies tests that take longer than a threshold or the N slowest tests. ```
        vendor/bin/pest --parallel --over=100 --slowest=5
        ```
    - **JSON Output**: Returns results as a JSON object (includes exit code, failures, timing, and coverage). ```
        vendor/bin/pest --format=json
        ```
    - **Caching**: Stores results (failures, timing, coverage map) to speed up subsequent runs. ```
        vendor/bin/pest --cache-dir=.pest-cache --rerun-failures
        ```
    - **Git-based Selection**: Runs only tests affected by changes since a specific ref or in the current working tree. Requires `--cache-dir` for best results (to use the coverage map). ```
        vendor/bin/pest --changed
        vendor/bin/pest --since=main
        ```

Test Output Formatter Skill
==================================================================================

[](#test-output-formatter-skill)

This package provides a Pest plugin and PHPStan error formatters to isolate failing tests, check coverage, and identify slow tests.

Pest Plugin Flags
--------------------------------------------------------------

[](#pest-plugin-flags)

### `--format=json`

[](#--formatjson)

Returns results as a JSON object. Useful for CI and AI agents.

- `exitCode`: The exit code of the Pest run.
- `failedFiles`: List of failing test files.
- `underCovered`: List of files below coverage threshold, including uncovered lines.
- `timing`: List of tests and their execution time.
- `coverageMap`: Mapping from source files to the tests that cover them.

### `--cache-dir=`

[](#--cache-dirdir)

Specifies a directory to store test results. Required for `--rerun-failures`, `--changed`, and `--since`.

### `--rerun-failures`

[](#--rerun-failures)

Only runs tests that failed in the previous run (requires `--cache-dir`).

### `--changed`

[](#--changed)

Runs tests affected by changes in the current Git working tree.

- Uses `coverageMap` from cache to identify which tests to run for changed source files.
- Fails open (runs all tests) if no coverage map is found or if a source file is not in the map.

### `--since=`

[](#--sinceref)

Runs tests affected by changes since the specified Git reference (e.g., `main`).

- Same logic as `--changed`.

### `--under=`

[](#--underpercentage)

Reports files with coverage below the specified percentage. Triggers `--coverage` automatically if not present.

### `--slowest=`

[](#--slowestcount)

Reports the N slowest tests.

### `--over=`

[](#--overms)

Reports tests taking longer than the specified milliseconds.

PHPStan Error Formatters
----------------------------------------------------------------------------

[](#phpstan-error-formatters)

- `testOutput`: File paths only.
- `testOutputCompact`: File, line, and message.
- `testOutputJson`: Full error details in JSON.

AI Agent Integration
--------------------------------------------------------------------

[](#ai-agent-integration)

When working with an AI agent:

1. Use `--format=json` to get a machine-readable summary of failures.
2. Use `--cache-dir` to maintain state across multiple agent steps.
3. Use `--rerun-failures` to quickly verify fixes.
4. Use `--changed` or `--since` to minimize the test suite for the current task.

### ErrorFormatter

[](#errorformatter)

#### Public methods of ErrorFormatter

[](#public-methods-of-errorformatter)

methodsummaryformatErrorsFormats the errors and outputs them to the console.### CompactErrorFormatter

[](#compacterrorformatter)

Custom PHPStan error formatter that outputs one line per error

#### Public methods of CompactErrorFormatter

[](#public-methods-of-compacterrorformatter)

methodsummaryformatErrors-### JsonErrorFormatter

[](#jsonerrorformatter)

#### Public methods of JsonErrorFormatter

[](#public-methods-of-jsonerrorformatter)

methodsummaryformatErrors----

Markdown file generated by [schenke-io/packaging-tools](https://github.com/schenke-io/packaging-tools)

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance91

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

4

Last Release

44d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/111449674?v=4)[Kay-Uwe Schenke](/maintainers/schenke-io)[@schenke-io](https://github.com/schenke-io)

---

Top Contributors

[![schenke-io](https://avatars.githubusercontent.com/u/111449674?v=4)](https://github.com/schenke-io "schenke-io (5 commits)")

###  Code Quality

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/schenke-io-test-output-formatter/health.svg)

```
[![Health](https://phpackages.com/badges/schenke-io-test-output-formatter/health.svg)](https://phpackages.com/packages/schenke-io-test-output-formatter)
```

###  Alternatives

[spatie/pest-plugin-snapshots

A package for snapshot testing in Pest

401.8M225](/packages/spatie-pest-plugin-snapshots)[spatie/pest-plugin-test-time

A Pest plugin to control the flow of time

501.6M126](/packages/spatie-pest-plugin-test-time)[markhuot/craft-pest-core

A Pest runner

2119.9k11](/packages/markhuot-craft-pest-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
