Skip to content

Commit

Permalink
Merge pull request #279 from pkothare/pkothare-278
Browse files Browse the repository at this point in the history
Fix handling of `Invoke-Maester` `Output*` params
  • Loading branch information
merill authored Jul 1, 2024
2 parents 5f808f8 + 310de15 commit 291a502
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions powershell/public/Invoke-Maester.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Function Invoke-Maester {
function ValidateAndSetOutputFiles($out) {
$result = $null
if (![string]::IsNullOrEmpty($out.OutputHtmlFile)) {
if ($out.OutputFile.EndsWith(".html") -eq $false) {
if ($out.OutputHtmlFile.EndsWith(".html") -eq $false) {
$result = "The OutputHtmlFile parameter must have an .html extension."
}
}
Expand All @@ -156,9 +156,11 @@ Function Invoke-Maester {
$result = "The OutputJsonFile parameter must have a .json extension."
}
}
if ([string]::IsNullOrEmpty($out.OutputFolder) -or `
(!$PassThru -and [string]::IsNullOrEmpty($out.OutputFolder) -and [string]::IsNullOrEmpty($out.OutputHtmlFile) `
-and [string]::IsNullOrEmpty($out.OutputMarkdownFile) -and [string]::IsNullOrEmpty($out.OutputJsonFile))) {

$someOutputFileHasValue = ![string]::IsNullOrEmpty($out.OutputHtmlFile) -or `
![string]::IsNullOrEmpty($out.OutputMarkdownFile) -or ![string]::IsNullOrEmpty($out.OutputJsonFile)

if ([string]::IsNullOrEmpty($out.OutputFolder) -and !$someOutputFileHasValue) {
# No outputs specified. Set default folder.
$out.OutputFolder = "./test-results"
}
Expand Down

0 comments on commit 291a502

Please sign in to comment.