|
1 | | -// A task runner that invokes Pester which runs all Pester tests under the |
| 1 | +// A task runner that invokes Pester to run all Pester tests under the |
2 | 2 | // current workspace folder. |
3 | 3 |
|
| 4 | +// NOTE: This Pester task runner requires an updated version of Pester (>=3.4.0) |
| 5 | +// in order for the problemMatcher to find failed test information (message, line, file). |
| 6 | +// If you don't have that version, you can update Pester from the PSGallery like so: |
| 7 | +// |
| 8 | +// PS C:\> Update-Module Pester |
| 9 | +// |
| 10 | +// If that gives an error like: |
| 11 | +// "Module 'Pester' was not installed by using Install-Module, so it cannot be updated." |
| 12 | +// then execute: |
| 13 | +// |
| 14 | +// PS C:\> Install-Module Pester -Scope CurrentUser -Force |
| 15 | +// |
| 16 | + |
4 | 17 | // Available variables which can be used inside of strings. |
5 | 18 | // ${workspaceRoot}: the root folder of the team |
6 | 19 | // ${file}: the current opened file |
|
21 | 34 | // Show the output window always |
22 | 35 | "showOutput": "always", |
23 | 36 |
|
24 | | - // Allow Pester to invoke scripts and run Pester |
25 | 37 | "args": [ |
26 | | - "-NoProfile", |
27 | | - "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process;", |
28 | | - "Write-Host 'Invoking Pester...'; Invoke-Pester;", |
| 38 | + "-NoProfile", "-ExecutionPolicy", "Bypass", |
| 39 | + "Write-Host 'Invoking Pester...'; Invoke-Pester -PesterOption @{IncludeVSCodeMarker=$true};", |
29 | 40 | "Invoke-Command { Write-Host \"Completed all tasks in task runner: $($args[0])\" } -args" |
30 | 41 | ], |
31 | 42 |
|
|
41 | 52 | "severity": "error", |
42 | 53 | "pattern": [ |
43 | 54 | { |
44 | | - "regexp": "^\\s*\\[-\\](.*?)(\\d+)ms\\s*$", |
45 | | - "message": 1 |
46 | | - }, |
47 | | - { |
48 | | - "regexp": "^.*$" |
49 | | - }, |
50 | | - { |
51 | | - "regexp": "^\\s+at line: (\\d+) in (.*)$", |
52 | | - "line": 1, |
53 | | - "file": 2, |
54 | | - "message": 2 |
55 | | - } |
56 | | - ] |
57 | | - }, |
58 | | - { |
59 | | - "owner": "powershell", |
60 | | - "fileLocation": ["absolute"], |
61 | | - "severity": "error", |
62 | | - "pattern": [ |
63 | | - { |
64 | | - "regexp": "^\\s*\\[-\\](.*?)(\\d+)ms\\s*$", |
65 | | - "message": 1 |
66 | | - }, |
67 | | - { |
68 | | - "regexp": "^.*$" |
69 | | - }, |
70 | | - { |
71 | | - "regexp": "^.*$" |
72 | | - }, |
73 | | - { |
74 | | - "regexp": "^\\s+at line: (\\d+) in (.*)$", |
75 | | - "line": 1, |
76 | | - "file": 2, |
77 | | - "message": 2 |
78 | | - } |
79 | | - ] |
80 | | - }, |
81 | | - { |
82 | | - "owner": "powershell", |
83 | | - "fileLocation": ["absolute"], |
84 | | - "severity": "error", |
85 | | - "pattern": [ |
86 | | - { |
87 | | - "regexp": "^\\s*\\[-\\](.*?)(\\d+)ms\\s*$", |
| 55 | + "regexp": "^\\s*(\\[-\\]\\s*.*?)(\\d+)ms\\s*$", |
88 | 56 | "message": 1 |
89 | 57 | }, |
90 | 58 | { |
91 | | - "regexp": "^.*$" |
92 | | - }, |
93 | | - { |
94 | | - "regexp": "^.*$" |
95 | | - }, |
96 | | - { |
97 | | - "regexp": "^.*$" |
98 | | - }, |
99 | | - { |
100 | | - "regexp": "^\\s+at line: (\\d+) in (.*)$", |
101 | | - "line": 1, |
102 | | - "file": 2, |
103 | | - "message": 2 |
104 | | - } |
105 | | - ] |
106 | | - }, |
107 | | - { |
108 | | - "owner": "powershell", |
109 | | - "fileLocation": ["absolute"], |
110 | | - "severity": "error", |
111 | | - "pattern": [ |
112 | | - { |
113 | | - "regexp": "^\\s*\\[-\\](.*?)(\\d+)ms\\s*$", |
114 | | - "message": 1 |
115 | | - }, |
116 | | - { |
117 | | - "regexp": "^.*$" |
118 | | - }, |
119 | | - { |
120 | | - "regexp": "^.*$" |
121 | | - }, |
122 | | - { |
123 | | - "regexp": "^.*$" |
124 | | - }, |
125 | | - { |
126 | | - "regexp": "^.*$" |
127 | | - }, |
128 | | - { |
129 | | - "regexp": "^\\s+at line: (\\d+) in (.*)$", |
130 | | - "line": 1, |
131 | | - "file": 2, |
132 | | - "message": 2 |
| 59 | + "regexp": "^\\s+at\\s+[^,]+,\\s*(.*?):\\s+line\\s+(\\d+)$", |
| 60 | + "file": 1, |
| 61 | + "line": 2 |
133 | 62 | } |
134 | 63 | ] |
135 | 64 | } |
|
0 commit comments