mirror of
https://github.com/dorny/test-reporter.git
synced 2026-03-22 07:52:14 +01:00
fix: Extract error message from PHPUnit error details when message attribute is missing
Fixes #711 When PHPUnit XML output contains <error> or <failure> elements without a message attribute, the parser now extracts the error message from the error details text instead of only showing the error type. The improved logic: 1. Prefer message attribute when present (with type prepended) 2. Extract error message from details when it contains a line matching the error type (e.g., "TypeError: ...") 3. Fall back to first line of details 4. Finally, use error type as last resort This provides more informative error messages in test reports when PHPUnit outputs errors with the full stack trace in the element text rather than a message attribute.
This commit is contained in:
parent
574d6b100c
commit
f0016cb1da
6 changed files with 165 additions and 11 deletions
|
|
@ -315,7 +315,7 @@ Failed asserting that 19 matches expected 20.
|
|||
|
||||
/workspace/phpcheckstyle/test/OtherTest.php:24",
|
||||
"line": 12,
|
||||
"message": "PHPUnit\\Framework\\ExpectationFailedException",
|
||||
"message": "OtherTest::testOther",
|
||||
"path": undefined,
|
||||
},
|
||||
"name": "testOther",
|
||||
|
|
@ -330,7 +330,7 @@ Failed asserting that 0 matches expected 1.
|
|||
|
||||
/workspace/phpcheckstyle/test/OtherTest.php:40",
|
||||
"line": 31,
|
||||
"message": "PHPUnit\\Framework\\ExpectationFailedException",
|
||||
"message": "OtherTest::testException",
|
||||
"path": undefined,
|
||||
},
|
||||
"name": "testException",
|
||||
|
|
@ -572,7 +572,7 @@ TestRunResult {
|
|||
/home/matteo/OSS/phpunit/src/TextUI/TestRunner.php:62
|
||||
/home/matteo/OSS/phpunit/src/TextUI/Application.php:200",
|
||||
"line": undefined,
|
||||
"message": "PHPUnit\\Framework\\PhptAssertionFailedError",
|
||||
"message": "targeting-traits-with-coversclass-attribute-is-deprecated.phptFailed asserting that string matches format description.",
|
||||
"path": undefined,
|
||||
},
|
||||
"name": "targeting-traits-with-coversclass-attribute-is-deprecated.phpt",
|
||||
|
|
@ -609,7 +609,7 @@ TestRunResult {
|
|||
/home/matteo/OSS/phpunit/src/TextUI/TestRunner.php:62
|
||||
/home/matteo/OSS/phpunit/src/TextUI/Application.php:200",
|
||||
"line": undefined,
|
||||
"message": "PHPUnit\\Framework\\PhptAssertionFailedError",
|
||||
"message": "targeting-traits-with-usesclass-attribute-is-deprecated.phptFailed asserting that string matches format description.",
|
||||
"path": undefined,
|
||||
},
|
||||
"name": "targeting-traits-with-usesclass-attribute-is-deprecated.phpt",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue