Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `$PSBPreference.Docs.AlphabeticParamsOrder`
- `$PSBPreference.Docs.ExcludeDontShow`
- `$PSBPreference.Docs.UseFullTypeName`
- The `$PSBPreference` variable now supports the following Pester test
configuration options:
- `$PSBPreference.Test.SkipRemainingOnFailure` can be set to **None**,
**Run**, **Container** and **Block**. The default value is **None**.
- `$PSBPreference.Test.OutputVerbosity` can be set to **None**, **Normal**,
**Detailed**, and **Diagnostic**. The default value is **Detailed**.

## [0.7.1] 2025-04-01

Expand Down
2 changes: 2 additions & 0 deletions PowerShellBuild/IB.tasks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ task Pester -If (. $pesterPreReqs) Build,{
CodeCoverageOutputFile = $PSBPreference.Test.CodeCoverage.OutputFile
CodeCoverageOutputFileFormat = $PSBPreference.Test.CodeCoverage.OutputFormat
ImportModule = $PSBPreference.Test.ImportModule
SkipRemainingOnFailure = $PSBPreference.Test.SkipRemainingOnFailure
OutputVerbosity = $PSBPreference.Test.OutputVerbosity
}
Test-PSBuildPester @pesterParams
}
Expand Down
15 changes: 13 additions & 2 deletions PowerShellBuild/Public/Test-PSBuildPester.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ function Test-PSBuildPester {
Code coverage result output format. Currently, only 'JaCoCo' is supported by Pester.
.PARAMETER ImportModule
Import module from OutDir prior to running Pester tests.
.PARAMETER SkipRemainingOnFailure
Skip remaining tests after failure for selected scope. Options are None, Run, Container and Block. Default: None.
.PARAMETER OutputVerbosity
The verbosity of output, options are None, Normal, Detailed and Diagnostic. Default is Detailed.
.EXAMPLE
PS> Test-PSBuildPester -Path ./tests -ModuleName Mymodule -OutputPath ./out/testResults.xml

Expand Down Expand Up @@ -54,7 +58,13 @@ function Test-PSBuildPester {

[string]$CodeCoverageOutputFileFormat = 'JaCoCo',

[switch]$ImportModule
[switch]$ImportModule,

[ValidateSet('None', 'Run', 'Container', 'Block')]
[string]$SkipRemainingOnFailure = 'None',

[ValidateSet('None', 'Normal', 'Detailed', 'Diagnostic')]
[string]$OutputVerbosity = 'Detailed'
)

if (-not (Get-Module -Name Pester)) {
Expand All @@ -76,8 +86,9 @@ function Test-PSBuildPester {

Import-Module Pester -MinimumVersion 5.0.0
$configuration = [PesterConfiguration]::Default
$configuration.Output.Verbosity = 'Detailed'
$configuration.Output.Verbosity = $OutputVerbosity
$configuration.Run.PassThru = $true
$configuration.Run.SkipRemainingOnFailure = $SkipRemainingOnFailure
$configuration.TestResult.Enabled = -not [string]::IsNullOrEmpty($OutputPath)
$configuration.TestResult.OutputPath = $OutputPath
$configuration.TestResult.OutputFormat = $OutputFormat
Expand Down
6 changes: 6 additions & 0 deletions PowerShellBuild/build.properties.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ $moduleVersion = (Import-PowerShellDataFile -Path $env:BHPSModuleManifest).Modul
# The code coverage output format to use
OutputFileFormat = 'JaCoCo'
}

# Skip remaining tests after failure for selected scope. Options are None, Run, Container and Block. Default: None.
SkipRemainingOnFailure = 'None'

# Set verbosity of output. Options are None, Normal, Detailed and Diagnostic. Default: Detailed.
OutputVerbosity = 'Detailed'
}
Help = @{
# Path to updatable help CAB
Expand Down
2 changes: 2 additions & 0 deletions PowerShellBuild/psakeFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ Task Pester -depends $PSBPreference.TaskDependencies.Pester -precondition $peste
CodeCoverageOutputFile = $PSBPreference.Test.CodeCoverage.OutputFile
CodeCoverageOutputFileFormat = $PSBPreference.Test.CodeCoverage.OutputFileFormat
ImportModule = $PSBPreference.Test.ImportModule
SkipRemainingOnFailure = $PSBPreference.Test.SkipRemainingOnFailure
OutputVerbosity = $PSBPreference.Test.OutputVerbosity
}
Test-PSBuildPester @pesterParams
} -description 'Execute Pester tests'
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ match your environment.
| $PSBPreference.Test.CodeCoverage.OutputFile | `coverage.xml` | Output file path (relative to Pester test directory) where Pester will save code coverage results to |
| $PSBPreference.Test.CodeCoverage.OutputFileFormat | `$null` | Test output format to use when saving Pester code coverage results |
| $PSBPreference.Test.ImportModule | `$false` | Import module from output directory prior to running Pester tests |
| $PSBPreference.Test.SkipRemainingOnFailure | `None` | Skip remaining tests after failure for selected scope. Options are None, Run, Container and Block. |
| $PSBPreference.Test.OutputVerbosity | `Detailed` | Set verbosity of output. Options are None, Normal, Detailed and Diagnostic. |
| $PSBPreference.Help.UpdatableHelpOutDir | `$OutDir/UpdatableHelp` | Output directory to store update module help (CAB) |
| $PSBPreference.Help.DefaultLocale | `(Get-UICulture).Name` | Default locale used for help generation |
| $PSBPreference.Help.ConvertReadMeToAboutHelp | `$false` | Convert project readme into the module about file |
Expand Down