Skip to content

Instantly share code, notes, and snippets.

@qbikez
Forked from nohwnd/example.tests.ps1
Last active February 27, 2016 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qbikez/019b9ec5e5bf6a899090 to your computer and use it in GitHub Desktop.
Save qbikez/019b9ec5e5bf6a899090 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,
"showOutput": "always",
"fileLocation": "absolute",
"args": ["Invoke-Pester"]
"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",
"fileLocation": "absolute",
"pattern": [
{
"regexp": "^\\s*\\[([-])\\]\\s+(.*)\\s+.*$",
"message": 2
},
{
"regexp": "(.*)",
"message": 1
},
{
"regexp": "(.*)",
"message": 1
},
{
"regexp": "(.*)",
"message": 1
},
{
"regexp": "^\\s*at.*,\\s*(.*):\\s*line\\s+([0-9]+)$",
"line": 2,
"file": 1,
"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",
"fileLocation": "absolute",
"pattern": [
{
//match pending tests
"regexp": "^\\s*\\[\\?\\]\\s+(.*)$",
"message": 1
},
{
"regexp": "^\\s*at line:\\s*([0-9]+)\\s+in\\s+(.*)$",
"line": 1,
"file": 2
}
]
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment