|
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 | | -// Available variables which can be used inside of strings. |
25 | | -// ${workspaceRoot}: the root folder of the team |
26 | | -// ${file}: the current opened file |
27 | | -// ${fileBasename}: the current opened file's basename |
28 | | -// ${fileDirname}: the current opened file's dirname |
29 | | -// ${fileExtname}: the current opened file's extension |
30 | | -// ${cwd}: the current working directory of the spawned process |
| 21 | +// Available variables which can be used inside of strings: |
| 22 | +// ${workspaceFolder} the path of the workspace folder that contains the tasks.json file |
| 23 | +// ${workspaceFolderBasename} the name of the workspace folder that contains the tasks.json file without any slashes (/) |
| 24 | +// ${file} the current opened file |
| 25 | +// ${relativeFile} the current opened file relative to the workspace folder containing the file |
| 26 | +// ${fileBasename} the current opened file's basename |
| 27 | +// ${fileBasenameNoExtension} the current opened file's basename without the extension |
| 28 | +// ${fileDirname} the current opened file's dirname |
| 29 | +// ${fileExtname} the current opened file's extension |
| 30 | +// ${cwd} the task runner's current working directory on startup |
| 31 | +// ${lineNumber} the current selected line number in the active file |
31 | 32 | { |
32 | | - "version": "2.0.0", |
33 | | - |
34 | | - // Start PowerShell |
| 33 | + "version": "2.0.0", |
35 | 34 | "windows": { |
36 | | - "command": "${env:windir}/System32/WindowsPowerShell/v1.0/powershell.exe", |
37 | | - "args": [ "-NoProfile", "-ExecutionPolicy", "Bypass" ] |
| 35 | + "options": { |
| 36 | + "shell": { |
| 37 | + "executable": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", |
| 38 | + "args": [ |
| 39 | + "-NoProfile", |
| 40 | + "-ExecutionPolicy", |
| 41 | + "Bypass", |
| 42 | + "-Command" |
| 43 | + ] |
| 44 | + } |
| 45 | + } |
38 | 46 | }, |
39 | 47 | "linux": { |
40 | | - "command": "/usr/bin/powershell", |
41 | | - "args": [ "-NoProfile" ] |
| 48 | + "options": { |
| 49 | + "shell": { |
| 50 | + "executable": "/usr/bin/pwsh", |
| 51 | + "args": [ |
| 52 | + "-NoProfile", |
| 53 | + "-Command" |
| 54 | + ] |
| 55 | + } |
| 56 | + } |
42 | 57 | }, |
43 | 58 | "osx": { |
44 | | - "command": "/usr/local/bin/powershell", |
45 | | - "args": [ "-NoProfile" ] |
| 59 | + "options": { |
| 60 | + "shell": { |
| 61 | + "executable": "/usr/local/bin/pwsh", |
| 62 | + "args": [ |
| 63 | + "-NoProfile", |
| 64 | + "-Command" |
| 65 | + ] |
| 66 | + } |
| 67 | + } |
46 | 68 | }, |
47 | | - |
48 | | - // Associate with test task runner |
49 | 69 | "tasks": [ |
50 | 70 | { |
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 | | - ] |
| 71 | + "label": "Clean", |
| 72 | + "type": "shell", |
| 73 | + "command": "Invoke-PSake build.ps1 -taskList Clean" |
57 | 74 | }, |
58 | 75 | { |
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 | | - ] |
| 76 | + "label": "Build", |
| 77 | + "type": "shell", |
| 78 | + "command": "Invoke-PSake build.ps1 -taskList Build", |
| 79 | + "group": { |
| 80 | + "kind": "build", |
| 81 | + "isDefault": true |
| 82 | + } |
66 | 83 | }, |
67 | 84 | { |
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.' }" |
| 85 | + "label": "Test", |
| 86 | + "type": "shell", |
| 87 | + "command": "Invoke-Pester -PesterOption @{IncludeVSCodeMarker=$true}", |
| 88 | + "group": { |
| 89 | + "kind": "test", |
| 90 | + "isDefault": true |
| 91 | + }, |
| 92 | + "problemMatcher": [ |
| 93 | + "$pester" |
73 | 94 | ] |
74 | 95 | }, |
75 | 96 | { |
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" |
| 97 | + "label": "Publish", |
| 98 | + "type": "shell", |
| 99 | + "command": "Invoke-PSake build.ps1 -taskList Publish" |
84 | 100 | } |
85 | 101 | ] |
86 | 102 | } |
0 commit comments