Skip to content

Instantly share code, notes, and snippets.

@aeinbu
Last active October 16, 2018 12:47
Show Gist options
  • Save aeinbu/ab73d85b00b0ea9dbbbe9e1031dc95ca to your computer and use it in GitHub Desktop.
Save aeinbu/ab73d85b00b0ea9dbbbe9e1031dc95ca to your computer and use it in GitHub Desktop.
Visual Studio Code task for running mocha tests with problem matcher
{
"version": "0.1.0",
"command": "mocha",
"isShellCommand": true,
"showOutput": "silent",
"args": [
"--reporter",
"tap",
"--colors"
],
"tasks": [
{
"taskName": "mocha",
"suppressTaskName": true,
"isTestCommand": true,
"showOutput": "silent",
"problemMatcher": {
"owner": "mocha",
"fileLocation": [
"relative",
"${workspaceRoot}"
],
"pattern": [
{
"regexp": "^not\\sok\\s\\d+\\s(.*)$"
},
{
"regexp": "\\s+(.*)$",
"message": 1
},
{
"regexp": "\\s+at\\s(.*)\\s\\((.*):(\\d+):(\\d+)\\)",
"file": 2,
"line": 3,
"column": 4
}
]
}
}
]
}
@rsxdalv
Copy link

rsxdalv commented Jul 19, 2017

{
            "taskName": "gulp --reporter tap",
            "command": "gulp",
            "isShellCommand": true,
            "args": [
                "--reporter",
                "tap"
            ],
            "showOutput": "silent",
            "problemMatcher": [
                {
                    "owner": "mocha",
                    "fileLocation": [
                        "relative",
                        "${workspaceRoot}"
                    ],
                    "pattern": [
                        {
                            "regexp": "^not\\sok\\s\\d+\\s(.*)$"
                        },
                        {
                            "regexp": "\\s+(.*)$",
                            "message": 1
                        },
                        {
                            "regexp": "\\s+at\\s(.*)\\s\\((.*):(\\d+):(\\d+)\\)",
                            "file": 2,
                            "line": 3,
                            "column": 4
                        }
                    ],
                    "background": {
                        "activeOnStart": true,
                        "beginsPattern": {
                            "regexp": "\\[[\\d]{2}:[\\d]{2}:[\\d]{2}\\] Starting 'tsc-app'\\.\\.\\."
                        },
                        "endsPattern": {
                            "regexp": "\\[[\\d]{2}:[\\d]{2}:[\\d]{2}\\] (Finished )?'tsc-app' (errored )?after"
                        }
                    }
                },
                {
                    "owner": "typescript",
                    "applyTo": "closedDocuments",
                    "fileLocation": [
                        "relative",
                        "${cwd}"
                    ],
                    "pattern": "$tsc",
                    "background": {
                        "activeOnStart": true,
                        "beginsPattern": {
                            "regexp": "\\[[\\d]{2}:[\\d]{2}:[\\d]{2}\\] Starting 'tsc-app'\\.\\.\\."
                        },
                        "endsPattern": {
                            "regexp": "\\[[\\d]{2}:[\\d]{2}:[\\d]{2}\\] (Finished )?'tsc-app' (errored )?after"
                        }
                    }
                }
            ]
        }```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment