|
1 | 1 | // A task runner that invokes Pester to run all Pester tests under the
|
2 | 2 | // current workspace folder.
|
3 |
| - |
4 |
| -// NOTE: This Test task runner requires an updated version of Pester (>=3.4.0) |
| 3 | +// NOTE: This Test task runner requires an updated version of Pester (>=4.0.3) |
5 | 4 | // in order for the problemMatcher to find failed test information (message, line, file).
|
6 | 5 | // If you don't have that version, you can update Pester from the PowerShell Gallery
|
7 | 6 | // with this command:
|
|
14 | 13 | //
|
15 | 14 | // PS C:\> Install-Module Pester -Scope CurrentUser -Force
|
16 | 15 | //
|
17 |
| - |
18 | 16 | // NOTE: The Clean, Build and Publish tasks require PSake. PSake can be installed
|
19 | 17 | // from the PowerShell Gallery with this command:
|
20 | 18 | //
|
21 | 19 | // PS C:\> Install-Module PSake -Scope CurrentUser -Force
|
22 | 20 | //
|
23 |
| - |
24 | 21 | // Available variables which can be used inside of strings.
|
25 | 22 | // ${workspaceRoot}: the root folder of the team
|
26 | 23 | // ${file}: the current opened file
|
|
29 | 26 | // ${fileExtname}: the current opened file's extension
|
30 | 27 | // ${cwd}: the current working directory of the spawned process
|
31 | 28 | {
|
32 |
| - "version": "2.0.0", |
| 29 | + "version": "2.0.0", |
33 | 30 |
|
34 |
| - // Start PowerShell |
35 | 31 | "windows": {
|
36 |
| - "command": "${env:windir}/System32/WindowsPowerShell/v1.0/powershell.exe", |
37 |
| - "args": [ "-NoProfile", "-ExecutionPolicy", "Bypass" ] |
| 32 | + "options": { |
| 33 | + "shell": { |
| 34 | + "executable": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", |
| 35 | + "args": [ |
| 36 | + "-NoProfile", |
| 37 | + "-ExecutionPolicy", |
| 38 | + "Bypass", |
| 39 | + "-Command" |
| 40 | + ] |
| 41 | + } |
| 42 | + } |
38 | 43 | },
|
39 | 44 | "linux": {
|
40 |
| - "command": "/usr/bin/powershell", |
41 |
| - "args": [ "-NoProfile" ] |
| 45 | + "options": { |
| 46 | + "shell": { |
| 47 | + "executable": "/usr/bin/pwsh", |
| 48 | + "args": [ |
| 49 | + "-NoProfile", |
| 50 | + "-Command" |
| 51 | + ] |
| 52 | + } |
| 53 | + } |
42 | 54 | },
|
43 | 55 | "osx": {
|
44 |
| - "command": "/usr/local/bin/powershell", |
45 |
| - "args": [ "-NoProfile" ] |
| 56 | + "options": { |
| 57 | + "shell": { |
| 58 | + "executable": "/usr/local/bin/pwsh", |
| 59 | + "args": [ |
| 60 | + "-NoProfile", |
| 61 | + "-Command" |
| 62 | + ] |
| 63 | + } |
| 64 | + } |
46 | 65 | },
|
47 | 66 |
|
48 | 67 | // Associate with test task runner
|
49 | 68 | "tasks": [
|
50 | 69 | {
|
51 |
| - "taskName": "Clean", |
52 |
| - "suppressTaskName": true, |
53 |
| - "args": [ |
54 |
| - "Write-Host 'Invoking PSake...'; Invoke-PSake build.ps1 -taskList Clean;", |
55 |
| - "Invoke-Command { Write-Host 'Completed Clean task in task runner.' }" |
56 |
| - ] |
| 70 | + "label": "Clean", |
| 71 | + "type": "shell", |
| 72 | + "command": "Invoke-PSake build.ps1 -taskList Clean" |
57 | 73 | },
|
58 | 74 | {
|
59 |
| - "taskName": "Build", |
60 |
| - "suppressTaskName": true, |
61 |
| - "isBuildCommand": true, |
62 |
| - "args": [ |
63 |
| - "Write-Host 'Invoking PSake...'; Invoke-PSake build.ps1 -taskList Build;", |
64 |
| - "Invoke-Command { Write-Host 'Completed Build task in task runner.' }" |
65 |
| - ] |
| 75 | + "label": "Build", |
| 76 | + "type": "shell", |
| 77 | + "command": "Invoke-PSake build.ps1 -taskList Build", |
| 78 | + "group": { |
| 79 | + "kind": "build", |
| 80 | + "isDefault": true |
| 81 | + } |
66 | 82 | },
|
67 | 83 | {
|
68 |
| - "taskName": "Publish", |
69 |
| - "suppressTaskName": true, |
70 |
| - "args": [ |
71 |
| - "Write-Host 'Invoking PSake...'; Invoke-PSake build.ps1 -taskList Publish;", |
72 |
| - "Invoke-Command { Write-Host 'Completed Publish task in task runner.' }" |
73 |
| - ] |
| 84 | + "label": "Test", |
| 85 | + "type": "shell", |
| 86 | + "command": "Invoke-Pester -PesterOption @{IncludeVSCodeMarker=$true}", |
| 87 | + "group": { |
| 88 | + "kind": "test", |
| 89 | + "isDefault": true |
| 90 | + }, |
| 91 | + "problemMatcher": "$pester" |
74 | 92 | },
|
75 | 93 | {
|
76 |
| - "taskName": "Test", |
77 |
| - "suppressTaskName": true, |
78 |
| - "isTestCommand": true, |
79 |
| - "args": [ |
80 |
| - "Write-Host 'Invoking Pester...'; $ProgressPreference = 'SilentlyContinue'; Invoke-Pester -PesterOption @{IncludeVSCodeMarker=$true};", |
81 |
| - "Invoke-Command { Write-Host 'Completed Test task in task runner.' }" |
82 |
| - ], |
83 |
| - "problemMatcher": "$pester" |
| 94 | + "label": "Publish", |
| 95 | + "type": "shell", |
| 96 | + "command": "Invoke-PSake build.ps1 -taskList Publish" |
84 | 97 | }
|
85 | 98 | ]
|
86 | 99 | }
|
0 commit comments