Skip to content

Instantly share code, notes, and snippets.

@nohwnd
Created November 5, 2015 21:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nohwnd/e064d04fad050fa9b178 to your computer and use it in GitHub Desktop.
Save nohwnd/e064d04fad050fa9b178 to your computer and use it in GitHub Desktop.
Pester problem matcher for VS Code
describe "DS"{
it "skipped" {} -skip
it "pending" {} -Pending
It "throw" { throw "sdfad" }
It "assertion fail" {1 | should be 10 }
It "string assertion fail" {"asdf" | should be "ffsad" }
it "success" {"adsf"}
}
Describing DS
[!] skipped 303ms
[?] pending 42ms
[-] throw 52ms
sdfad
at line: 4 in C:\Users\nohwnd\Desktop\vscode\Untitled18.tests.ps1
[-] assertion fail 63ms
Expected: {10}
But was: {1}
at line: 5 in C:\Users\nohwnd\Desktop\vscode\Untitled18.tests.ps1
5: It "assertion fail" {1 | should be 10 }
[-] string assertion fail 36ms
Expected string length 5 but was 4. Strings differ at index 0.
Expected: {ffsad}
But was: {asdf}
-----------^
at line: 6 in C:\Users\nohwnd\Desktop\vscode\Untitled18.tests.ps1
6: It "string assertion fail" {"asdf" | should be "ffsad" }
[+] success 13ms
Tests completed in 512ms
Passed: 1 Failed: 3 Skipped: 1 Pending: 1
{
"version": "0.1.0",
"command": "powershell",
"isShellCommand": true,
"args": ["Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process; Invoke-Pester"],
"showOutput": "always",
"fileLocation": "absolute",
"tasks": [ {
"taskName" : "test",
"isTestCommand" : true,
"suppressTaskName": true,
"problemMatcher": [{
"owner": "pester",
"severity": "error",
"pattern":[ {
"regexp": "^\\s*\\[([-])\\]\\s+(.*)\\s+.*$",
"message": 2
},
{
"regexp": "(.*)",
"message": 1
},
{
"regexp": "^.*\\:\\s*(\\d+)\\s*in\\s*(.*)\\s*$",
"line": 1,
"file": 2,
"loop": true
}]
},
{
"owner": "pester",
"severity": "error",
"pattern":[ {
"regexp": "^\\s*\\[([-])\\]\\s+(.*)\\s+.*$",
"message": 2
},
{
"regexp": "(.*)",
"message": 1
},
{
"regexp": "(.*)",
"message": 1
},
{
"regexp": "^.*\\:\\s*(\\d+)\\s*in\\s*(.*)\\s*$",
"line": 1,
"file": 2,
"loop": true
}]
},
{
"owner": "pester",
"severity": "error",
"pattern":[ {
"regexp": "^\\s*\\[([-])\\]\\s+(.*)\\s+.*$",
"message": 2
},
{
"regexp": "(.*)",
"message": 1
},
{
"regexp": "(.*)",
"message": 1
},
{
"regexp": "(.*)",
"message": 1
},
{
"regexp": "(.*)",
"message": 1
},
{
"regexp": "^.*\\:\\s*(\\d+)\\s*in\\s*(.*)\\s*$",
"line": 1,
"file": 2,
"loop": true
}]
},
{
"owner": "pester",
"severity": "info",
"pattern":{
//match skipped tests
"regexp": "^\\s*\\[?\\]\\s+(.*)\\s+.*$",
"message": 2
//missing file so this does not work
}
},
{
"owner": "pester",
"severity": "warning",
"pattern":{
//match pending tests
"regexp": "^\\s*\\[?\\]\\s+(.*)\\s+.*$",
"message": 2
}
}]
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment