Skip to content

fix: stop composer test from masking failures and skipping tests#92

Merged
valbeat merged 1 commit into
mainfrom
fix/composer-test-script
Jul 7, 2026
Merged

fix: stop composer test from masking failures and skipping tests#92
valbeat merged 1 commit into
mainfrom
fix/composer-test-script

Conversation

@valbeat

@valbeat valbeat commented Jul 7, 2026

Copy link
Copy Markdown
Owner

概要

コードレビューで指摘した「composer test がテスト失敗を握りつぶす」問題の修正です。調査の結果、実際はさらに悪い状態でした。

問題

  1. "test": "phpunit --do-not-fail-on-warning || exit 0"|| exit 0 により、テストが失敗しても composer test(および composer check)は成功扱いになる
  2. さらに、phpunit.xml の <coverage> レポート設定により、カバレッジドライバ(pcov/xdebug)が無い環境では PHPUnit 12 がテストを 1 件も実行せず終了することを確認しました:
1) No code coverage driver available
No tests executed!

つまりドライバ無しのローカル環境では「テスト 0 件実行 + exit 0」で、composer check が何も検証していませんでした。

修正

  • || exit 0--do-not-fail-on-warning を削除(警告での失敗は phpunit.xml の failOnWarning="false" で既に制御されており冗長)
  • phpunit.xml の <coverage> レポートブロックを削除。CI は pcov をロードした上で --coverage-clover 等を CLI フラグで渡しているため、この XML 設定は CI では未使用でした

検証(PHP 8.4.7、カバレッジドライバなし)

  • 修正後 phpunit: 69 tests / 111 assertions パス、exit 0
  • 故意に失敗するテストを置いた場合: exit 1(失敗が伝播することを確認後、削除)
  • composer validate --strict: パス

https://claude.ai/code/session_017XTM7pxbWPVNLV639i5WgK

The test script appended '|| exit 0', so 'composer test' (and the
'check' aggregate) reported success even when tests failed.

Worse, the <coverage> report block in phpunit.xml made PHPUnit 12
abort without running any tests when no coverage driver (pcov/xdebug)
is loaded — locally that meant 'No tests executed!' while the script
still exited 0. CI is unaffected: it loads pcov and passes coverage
options on the command line, so the XML report block was unused.

Remove both. 'composer test' now runs the suite everywhere and
propagates failures; coverage reports remain available via the CLI
flags CI already uses.

Claude-Session: https://claude.ai/code/session_017XTM7pxbWPVNLV639i5WgK
@valbeat valbeat self-assigned this Jul 7, 2026
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@valbeat, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 62f5cdc2-eefa-415e-be05-49cf28284e21

📥 Commits

Reviewing files that changed from the base of the PR and between 98a2fcb and 4793af5.

📒 Files selected for processing (2)
  • composer.json
  • phpunit.xml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/composer-test-script

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (98a2fcb) to head (4793af5).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##                main       #92   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity        40        40           
===========================================
  Files              2         2           
  Lines             80        80           
===========================================
  Hits              80        80           
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request simplifies the test script in composer.json to run phpunit directly, ensuring that test failures and warnings are properly reported instead of being suppressed. It also removes the code coverage configuration from phpunit.xml. I have no further feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@valbeat valbeat marked this pull request as ready for review July 7, 2026 04:35
Copilot AI review requested due to automatic review settings July 7, 2026 04:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the local/CI developer workflow by ensuring composer test and composer check correctly fail when the test suite fails, and by preventing PHPUnit from skipping all tests on environments without a coverage driver due to XML coverage configuration.

Changes:

  • Update composer.json so composer test runs PHPUnit directly (no longer masks failures).
  • Remove <coverage> reporting configuration from phpunit.xml to avoid “No code coverage driver available / No tests executed!” behavior when no coverage driver is installed.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
phpunit.xml Removes built-in coverage report configuration so PHPUnit still executes tests when no coverage driver is available.
composer.json Makes composer test run phpunit without masking failures, so composer check properly reflects test outcomes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@valbeat valbeat merged commit c5538d1 into main Jul 7, 2026
10 checks passed
@valbeat valbeat deleted the fix/composer-test-script branch July 7, 2026 06:34
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.

2 participants