schenke-io/test-output-formatter
最新稳定版本:v0.0.4
Composer 安装命令:
composer require schenke-io/test-output-formatter
包简介
Isolates failing test files and under-coverage classes for rapid triage.
README 文档
README
Test Output Formatter
Isolates failing test files and under-coverage classes for rapid 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 Skill
Installation
composer require --dev schenke-io/test-output-formatter
Auto-Registration
The package uses standard discovery mechanisms to integrate with your tools:
- PHPStan: The extension is automatically registered via the
phpstan-extensiontype incomposer.jsonand theextension.neonfile. 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.pluginsconfiguration incomposer.json. No additional configuration is required.
Features
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
- File paths only:
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-dirfor best results (to use the coverage map).vendor/bin/pest --changed vendor/bin/pest --since=main
- Failures only: Just gives you the list of failing test files.
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
--format=json
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=<dir>
Specifies a directory to store test results. Required for --rerun-failures, --changed, and --since.
--rerun-failures
Only runs tests that failed in the previous run (requires --cache-dir).
--changed
Runs tests affected by changes in the current Git working tree.
- Uses
coverageMapfrom 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=<ref>
Runs tests affected by changes since the specified Git reference (e.g., main).
- Same logic as
--changed.
--under=<percentage>
Reports files with coverage below the specified percentage. Triggers --coverage automatically if not present.
--slowest=<count>
Reports the N slowest tests.
--over=<ms>
Reports tests taking longer than the specified milliseconds.
PHPStan Error Formatters
testOutput: File paths only.testOutputCompact: File, line, and message.testOutputJson: Full error details in JSON.
AI Agent Integration
When working with an AI agent:
- Use
--format=jsonto get a machine-readable summary of failures. - Use
--cache-dirto maintain state across multiple agent steps. - Use
--rerun-failuresto quickly verify fixes. - Use
--changedor--sinceto minimize the test suite for the current task.
ErrorFormatter
Public methods of ErrorFormatter
| method | summary |
|---|---|
| formatErrors | Formats the errors and outputs them to the console. |
CompactErrorFormatter
Custom PHPStan error formatter that outputs one line per error
Public methods of CompactErrorFormatter
| method | summary |
|---|---|
| formatErrors | - |
JsonErrorFormatter
Public methods of JsonErrorFormatter
| method | summary |
|---|---|
| formatErrors | - |
Markdown file generated by schenke-io/packaging-tools
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-06