Skip to content

Commit 68cb557

Browse files
Support adding an OutputFile and allow running from command pallet (#2730)
* Support adding OutputPath and run file * refactor all logic
1 parent 4b3c3dc commit 68cb557

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

module/PowerShellEditorServices/InvokePesterStub.ps1

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ param(
5353
[switch] $MinimumVersion5,
5454

5555
[Parameter(Mandatory)]
56-
[string] $Output
56+
[string] $Output,
57+
58+
[Parameter()]
59+
[string] $OutputPath
5760
)
5861

5962
$pesterModule = Microsoft.PowerShell.Core\Get-Module Pester
@@ -103,6 +106,14 @@ if ($All) {
103106
if ("FromPreference" -ne $Output) {
104107
$configuration.Add('Output', @{ Verbosity = $Output })
105108
}
109+
110+
if ($OutputPath) {
111+
$configuration.Add('TestResult', @{
112+
Enabled = $true
113+
OutputFormat = "NUnit2.5"
114+
OutputPath = $OutputPath
115+
})
116+
}
106117
Pester\Invoke-Pester -Configuration $configuration | Out-Null
107118
}
108119
elseif ($pesterModule.Version -ge '3.4.5') {
@@ -132,6 +143,15 @@ elseif (($LineNumber -match '\d+') -and ($pesterModule.Version -ge '4.6.0')) {
132143
if ("FromPreference" -ne $Output) {
133144
$configuration.Add('Output', @{ Verbosity = $Output })
134145
}
146+
147+
if ($OutputPath) {
148+
$configuration.Add('TestResult', @{
149+
Enabled = $true
150+
OutputFormat = "NUnit2.5"
151+
OutputPath = $OutputPath
152+
})
153+
}
154+
135155
Pester\Invoke-Pester -Configuration $configuration | Out-Null
136156
}
137157
else {

0 commit comments

Comments
 (0)