Skip to content

New Feature: console_output パラメータでコンソール出力モードを制御#30

Merged
wadakatu merged 5 commits intomainfrom
feat/console-output-mode
Mar 2, 2026
Merged

New Feature: console_output パラメータでコンソール出力モードを制御#30
wadakatu merged 5 commits intomainfrom
feat/console-output-mode

Conversation

@wadakatu
Copy link
Collaborator

@wadakatu wadakatu commented Mar 2, 2026

概要

コンソール出力で未カバーのエンドポイントを個別表示するオプションを追加。大規模 API(300+ エンドポイント)で、ターミナルから直接未カバーのエンドポイントを確認できるようになります。

変更内容

  • ConsoleOutput enum を新規追加(default / all / uncovered_only の3モード)
    • resolve() ファクトリメソッドで環境変数 > phpunit.xml パラメータ > デフォルトの優先順位を処理
    • 大文字小文字を区別せず、前後の空白をトリム、無効値は default にフォールバック
  • ConsoleCoverageRenderer を新規追加(MarkdownCoverageRenderer と対称的な設計)
    • echo ではなく string を返すことでテスタブルに
    • default: covered 個別リスト + uncovered 件数のみ(既存動作)
    • all: 両方を個別リスト
    • uncovered_only: uncovered 個別リスト + covered 件数のみ
  • OpenApiCoverageExtension を修正し、console_output パラメータのパースと ConsoleCoverageRenderer への委譲を実装
  • ユニットテスト追加(ConsoleOutputTest: 14テスト、ConsoleCoverageRendererTest: 12テスト)
  • README にパラメータ説明、3モードの出力例、環境変数 OPENAPI_CONSOLE_OUTPUT の使用方法、GitHub Actions での CI 例を追加

関連情報

wadakatu added 5 commits March 2, 2026 16:27
Introduce ConsoleOutput string-backed enum with DEFAULT, ALL, and
UNCOVERED_ONLY cases plus a resolve() factory that handles env var >
parameter > default priority. Add ConsoleCoverageRenderer with a
static render() method that produces console coverage output
supporting the three display modes.

Ref #27
Integrate ConsoleOutput enum and ConsoleCoverageRenderer into
OpenApiCoverageExtension, replacing inline printReport() and
percentage() methods. Parse console_output parameter and pass
ConsoleOutput to the subscriber.

Refs: #27
Document the console_output parameter and OPENAPI_CONSOLE_OUTPUT
environment variable. Add output examples for all three modes
(default, all, uncovered_only) and a GitHub Actions CI example.

Refs #27
…nderer logic

Add stderr warnings when invalid values are provided for the
OPENAPI_CONSOLE_OUTPUT env var or console_output phpunit.xml parameter.
Remove arithmetic-derived uncoveredCount in favor of count() on the
actual uncovered array. Add edge-case tests for zero coverage, full
coverage, and percentage rounding.
@wadakatu wadakatu merged commit 11ee144 into main Mar 2, 2026
8 checks passed
@wadakatu wadakatu deleted the feat/console-output-mode branch March 2, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to display uncovered endpoints in console output

1 participant