feat: surface failing test name inline + simplify reporter internals#14
Conversation
Add `Test failed: <full_name>` line to inline AI Context output so report consumers see which test produced the captured failure. Extend unit coverage for inline-context printing across failure/error/ warning statuses, the disabled `report` option, non-failure statuses, and end-to-end report writing.
Drop redundant array_values() wrap on HintGenerator output (already a list), nullsafe the suite-name extraction, collapse normalizeArtifacts into a single ternary, and extract a printSection() helper to remove the repeated section-printing boilerplate in printInlineContext().
Replace six near-identical type/value checks with three private helpers (readEnum, readPositiveInt, readBool) plus one dedicated readOutput that falls back to the supplied default on null/empty. The helpers narrow `mixed` cleanly, so the @phpstan-ignore-next-line suppressions are no longer needed.
Add tests/Support/Fixture/PathNormalizerFactory to replace three ad-hoc constructions of PathNormalizer across the report and trace test files. Collapse the two single-case `testInvalidFormatThrows` / `testInvalidMaxFramesThrows` methods into a data-driven `testInvalidConfigThrows` and extend coverage to the bool / output / non-int cases exercised by the new ReporterConfig validator helpers.
ReporterConfig::fromArray previously rtrim-ed the resolved output directory, which could collapse a root path (e.g. "/") into an empty string and violate the @var non-empty-string contract. Keep the trimmed value only when it is still non-empty; otherwise fall back to the resolved path. AiReporterTest::makeStubTest cast ReflectionClass::getFileName() straight to string. Guard with assertNotFalse so a future internal class swap fails loudly instead of silently passing an empty filename.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (13)
📝 WalkthroughWalkthroughThis PR refactors configuration validation and reporter output rendering while introducing reusable test fixtures. It updates three core classes with simplifications and immutability constraints, then consolidates test infrastructure to reduce duplication and improve maintainability. ChangesCore Refactoring and Test Infrastructure
🎯 3 (Moderate) | ⏱️ ~25 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
🎉 This PR is included in version 1.2.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
Test failed: <full_name>inside the inline AI Context block so failures are scannable without opening the JSON/text report.printSectionhelper, drop redundantarray_valueswrap, nullsafe suite name, collapsenormalizeArtifacts, fold opposingisNoiseFramebranches, markPathNormalizerrootsreadonly, replace six near-identical validation blocks inReporterConfig::fromArraywithreadEnum/readOutput/readPositiveInt/readBoolhelpers (and drop the@phpstan-ignore-next-linesuppressions).PathNormalizerFactoryfixture; data-driventestInvalidConfigThrows.ReflectionClass::getFileName()inmakeStubTest; preserve resolved path whenrtrimwould empty a root$outputDir..php-version8.3.30 → 8.3.31,phpunit12.5.23 → 12.5.24.Test plan
composer test— 38 tests / 113 assertionscomposer stan— clean (no errors atlevel: max)composer cs:check— cleancoderabbit review --agent -t all --base main— 0 findings after fixesvendor/bin/codecept run --reportand inspecttests/_output/ai-report.{json,txt}shape unchanged for a real failing suiteNeed help on this PR? Tag
@codesmithwith what you need.Summary by CodeRabbit
Release Notes
Chores
Tests