Skip to content

Commit 93bc21c

Browse files
authored
Update examples tasks.json for 2.0.0 schema (#1112)
* Update Examples tasks.json for 2.0 schema Fix #1111 * Update info on available variables
1 parent 3a929b0 commit 93bc21c

File tree

1 file changed

+64
-48
lines changed

1 file changed

+64
-48
lines changed

examples/.vscode/tasks.json

+64-48
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// A task runner that invokes Pester to run all Pester tests under the
22
// 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)
54
// in order for the problemMatcher to find failed test information (message, line, file).
65
// If you don't have that version, you can update Pester from the PowerShell Gallery
76
// with this command:
@@ -14,73 +13,90 @@
1413
//
1514
// PS C:\> Install-Module Pester -Scope CurrentUser -Force
1615
//
17-
1816
// NOTE: The Clean, Build and Publish tasks require PSake. PSake can be installed
1917
// from the PowerShell Gallery with this command:
2018
//
2119
// PS C:\> Install-Module PSake -Scope CurrentUser -Force
2220
//
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
3132
{
32-
"version": "2.0.0",
33-
34-
// Start PowerShell
33+
"version": "2.0.0",
3534
"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+
}
3846
},
3947
"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+
}
4257
},
4358
"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+
}
4668
},
47-
48-
// Associate with test task runner
4969
"tasks": [
5070
{
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"
5774
},
5875
{
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+
}
6683
},
6784
{
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"
7394
]
7495
},
7596
{
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"
84100
}
85101
]
86102
}

0 commit comments

Comments
 (0)