From fd2044be8d26d5bba614860c35b6cd49f5676c27 Mon Sep 17 00:00:00 2001 From: John Rayes Date: Mon, 19 Oct 2026 10:49:50 -0700 Subject: [PATCH] ci: Extend PHPUnit problem matcher to annotate more test outcomes The matcher only annotated failures whose output matched a single layout ("Failed asserting that..." followed by a blank line and file:line). Extend it so more of the output PHPUnit produces is surfaced as GitHub annotations: - Failures with no blank line before file:line - Failures with a custom assertion message ahead of "Failed asserting", with and without a blank line (e.g. BBCTest attribute breakout) - Risky tests and skipped tests that have a reason, as warnings - Skipped tests with no reason (header followed by file:line), as warnings - Tests skipped through @depends, which print no file:line, as warnings The warning-level matchers exclude "Failed asserting" lines so failures are not annotated a second time. --- src/configs/pm/phpunit.json | 81 ++++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 15 deletions(-) diff --git a/src/configs/pm/phpunit.json b/src/configs/pm/phpunit.json index 2cc9dab1..67ef3aca 100644 --- a/src/configs/pm/phpunit.json +++ b/src/configs/pm/phpunit.json @@ -3,21 +3,72 @@ { "owner": "phpunit", "pattern": [ - { - "regexp": "^\\d+\\)\\s.*$" - }, - { - "regexp": "^(.*Failed\\sasserting\\sthat.*)$", - "message": 1 - }, - { - "regexp": "^\\s*$" - }, - { - "regexp": "^(.*):(\\d+)$", - "file": 1, - "line": 2 - } + { "regexp": "^\\d+\\)\\s.*$" }, + { "regexp": "^(.*Failed\\sasserting\\sthat.*)$", "message": 1 }, + { "regexp": "^\\s*$" }, + { "regexp": "^(.*):(\\d+)$", "file": 1, "line": 2 } + ] + }, + { + "owner": "phpunit-no-blank", + "pattern": [ + { "regexp": "^\\d+\\)\\s.*$" }, + { "regexp": "^(.*Failed\\sasserting\\sthat.*)$", "message": 1 }, + { "regexp": "^(.*):(\\d+)$", "file": 1, "line": 2 } + ] + }, + { + "owner": "phpunit-custom-message", + "pattern": [ + { "regexp": "^\\d+\\)\\s.*$" }, + { "regexp": "^(?!.*Failed\\sasserting)(?!.*:\\d+$)(.+)$", "message": 1 }, + { "regexp": "^.*Failed\\sasserting\\sthat.*$" }, + { "regexp": "^(.*):(\\d+)$", "file": 1, "line": 2 } + ] + }, + { + "owner": "phpunit-custom-message-blank", + "pattern": [ + { "regexp": "^\\d+\\)\\s.*$" }, + { "regexp": "^(?!.*Failed\\sasserting)(?!.*:\\d+$)(.+)$", "message": 1 }, + { "regexp": "^.*Failed\\sasserting\\sthat.*$" }, + { "regexp": "^\\s*$" }, + { "regexp": "^(.*):(\\d+)$", "file": 1, "line": 2 } + ] + }, + { + "owner": "phpunit-other-blank", + "severity": "warning", + "pattern": [ + { "regexp": "^\\d+\\)\\s.*$" }, + { "regexp": "^(?!.*Failed\\sasserting)(?!.*:\\d+$)(.+)$", "message": 1 }, + { "regexp": "^\\s*$" }, + { "regexp": "^(.*):(\\d+)$", "file": 1, "line": 2 } + ] + }, + { + "owner": "phpunit-other", + "severity": "warning", + "pattern": [ + { "regexp": "^\\d+\\)\\s.*$" }, + { "regexp": "^(?!.*Failed\\sasserting)(?!.*:\\d+$)(.+)$", "message": 1 }, + { "regexp": "^(.*):(\\d+)$", "file": 1, "line": 2 } + ] + }, + { + "owner": "phpunit-skipped-no-reason", + "severity": "warning", + "pattern": [ + { "regexp": "^(\\d+\\)\\s.*)$", "message": 1 }, + { "regexp": "^(.*):(\\d+)$", "file": 1, "line": 2 } + ] + }, + { + "owner": "phpunit-skipped-depends", + "severity": "warning", + "pattern": [ + { "regexp": "^\\d+\\)\\s(.*)$" }, + { "regexp": "^(This test depends on .*)$", "message": 1 } ] } ]