mheap / phpunit-matcher-action

Add annotations to your PHPUnit tests when running under Github Actions
32 stars 6 forks source link

Fix message escaping #4

Closed mheap closed 3 years ago

mheap commented 3 years ago

This PR fixes #3, which has useful information being truncated due to an incorrect regex that stops at the first ' detected. This change switches to a greedy matcher, which matches all characters until it encounters '.+details

Tested via https://problem-matcher.netlify.app/

Log input:

##teamcity[testFailed name='testDescribeJson' message='PDOException : SQLSTATE|[42000|]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near |'(3) DEFAULT CURRENT_TIMESTAMP(3),|' at line 9' details=' {{GITHUB_WORKSPACE}}/file.php:72|n ' duration='4' flowId='9424']

Test matcher:

{
  "owner": "eslint-stylish",
  "pattern": [
    {
      "regexp": "##teamcity\\[testFailed.+message='(.+)'.+details='\\s+{{GITHUB_WORKSPACE}}/([^:]+):(\\d+)[^']+'",
      "file": 2,
      "line": 3,
      "message": 1
    }
  ]
}