Skip to content

Instantly share code, notes, and snippets.

@gerane
Created March 17, 2017 14:53
Show Gist options
  • Save gerane/e3b646e5abfdd33ed8bc6c1dcc6990e9 to your computer and use it in GitHub Desktop.
Save gerane/e3b646e5abfdd33ed8bc6c1dcc6990e9 to your computer and use it in GitHub Desktop.
Code Coverage VSCode Task
{
"version": "0.1.0",
"windows": {
"command": "${env.windir}\\sysnative\\windowspowershell\\v1.0\\PowerShell.exe"
},
"linux": {
"command": "/usr/bin/powershell"
},
"osx": {
"command": "/usr/local/bin/powershell"
},
"isShellCommand": true,
"showOutput": "always",
"args": [
"-NoProfile", "-ExecutionPolicy", "Bypass"
],
"tasks": [
{
"taskName": "Watch.Project",
"isTestCommand": true,
"suppressTaskName": true,
"args": [
"Write-Host 'Watching Project';",
"Import-Module -Name Pester -RequiredVersion 3.4.3 -Force;",
"Import-Module -Name PowerShellGuard;",
"New-Guard -Path \"${workspaceRoot}\" -PathFilter \"*.ps1\" -MonitorSubdirectories -TestPath \"${workspaceRoot}\\Tests\" -TestCommand {Write-Host \"Invoking Watch.Project\"; Invoke-Pester -CodeCoverage (gci \"${workspaceRoot}\\${workspaceRootFolderName}\\*.ps1\" -recurse) -PesterOption @{IncludeVSCodeMarker=$true}; Write-Host \"Finished Watch.Project\"} -Wait;"
],
"isBackground": true,
"problemMatcher": [
{
"owner": "Watch.Project",
"fileLocation": "absolute",
"pattern": [
{
"regexp": "^\\s*(\\[-\\]\\s*.*?)(\\d+)ms\\s*$",
"message": 1
},
{
"regexp": "^\\s+at\\s+[^,]+,\\s*(.*?):\\s+line\\s+(\\d+)$",
"file": 1,
"line": 2
}
],
"watching": {
"activeOnStart": true,
"beginsPattern": "^Invoking Watch\\.Project$",
"endsPattern": "^Passed:\\s\\d+\\sFailed:\\s\\d+\\sSkipped:\\s\\d+\\sPending:\\s\\d+\\sInconclusive:\\s\\d+\\s$"
}
},
{
"owner": "Watch.Project.CodeCoverage",
"fileLocation": ["relative", "${workspaceRoot}\\${workspaceRootFolderName}"],
"pattern": [
{
"regexp": "^([Private|Public][\\s\\S]+\\.ps1).*\\s(\\d+)\\s(.*)$",
"message": 3,
"file": 1,
"line": 2
}
],
"watching": {
"activeOnStart": true,
"beginsPattern": "^Invoking Watch\\.Project$",
"endsPattern": "^Finished Watch\\.Project.*$"
}
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment