Created
March 24, 2016 15:44
-
-
Save Xainey/8b18eec27bf76f7dcd9c to your computer and use it in GitHub Desktop.
run .vscode pester tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A task runner that invokes Pester to run all Pester tests under the | |
// current workspace folder. | |
// NOTE: This Pester task runner requires an updated version of Pester (>=3.4.0) | |
// in order for the problemMatcher to find failed test information (message, line, file). | |
// If you don't have that version, you can update Pester from the PSGallery like so: | |
// | |
// PS C:\> Update-Module Pester | |
// | |
// If that gives an error like: | |
// "Module 'Pester' was not installed by using Install-Module, so it cannot be updated." | |
// then execute: | |
// | |
// PS C:\> Install-Module Pester -Scope CurrentUser -Force | |
// | |
// Available variables which can be used inside of strings. | |
// ${workspaceRoot}: the root folder of the team | |
// ${file}: the current opened file | |
// ${fileBasename}: the current opened file's basename | |
// ${fileDirname}: the current opened file's dirname | |
// ${fileExtname}: the current opened file's extension | |
// ${cwd}: the current working directory of the spawned process | |
{ | |
"version": "0.1.0", | |
// Start PowerShell | |
"command": "${env.windir}\\sysnative\\windowspowershell\\v1.0\\PowerShell.exe", | |
// The command is a shell script | |
"isShellCommand": true, | |
// Show the output window always | |
"showOutput": "always", | |
"args": [ | |
"-NoProfile", "-ExecutionPolicy", "Bypass", | |
"Write-Host 'Invoking Pester...'; Invoke-Pester -PesterOption @{IncludeVSCodeMarker=$true};", | |
"Invoke-Command { Write-Host \"Completed all tasks in task runner: $($args[0])\" } -args" | |
], | |
// Associate with test task runner | |
"tasks": [ | |
{ | |
"taskName": "Pester", | |
"isTestCommand": true, | |
"problemMatcher": [ | |
{ | |
"owner": "powershell", | |
"fileLocation": ["absolute"], | |
"severity": "error", | |
"pattern": [ | |
{ | |
"regexp": "^\\s*(\\[-\\]\\s*.*?)(\\d+)ms\\s*$", | |
"message": 1 | |
}, | |
{ | |
"regexp": "^\\s+at\\s+[^,]+,\\s*(.*?):\\s+line\\s+(\\d+)$", | |
"file": 1, | |
"line": 2 | |
} | |
] | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment