Skip to content

Provide problem matcher #2

@bryceschober

Description

@bryceschober

It sure would be nice if this extension provided a problem matcher. I've worked up one that kinda basically works, but it's pretty long to copy around to the multiple test-subset tasks that I have in my workspace. The best I've come up with looks like:

    {
      "label": "Run all shell tests",
      "type": "shell",
      "command": "./test/lib/bats/bin/bats test/",
      "group": "test",
      "presentation": {
        "reveal": "always",
        "panel": "dedicated",
        "showReuseMessage": false,
        "clear": true
      },
      "problemMatcher": {
        "fileLocation": ["relative", "${workspaceFolder}"],
        "pattern": [
          // Regex testing at regexr.com/498rl
          { // Get file & line from the 1st line, like:
            //    (in test file test/examples.bats, line 10)
              "regexp": "\\s*\\(?in test file ([^,]+), line (\\d+)\\)\\s*",
              "file": 1,
              "line": 2
          },
          { // Get message from the 2nd line, like:
            //      `[ "$result" -eq 3 ]' failed
            // TODO: Support capture of multi-line output from bats extensions when this issue is
            // resolved: https://github.com/Microsoft/vscode/issues/9635 
              "regexp": "^\\s*(.*)\\s*$",
              "message": 1,
          }
        ]
      }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions