Description
Currently PowerShellBuild accepts several options to control how Pester is invoked through the $PSBPreference
variable. However, there are more Pester options available if you go the "advanced" route and pass in a [PesterConfiguration]
object.
You can generate a configuration a few different ways...
$config = New-PesterConfiguration
$config = [PesterConfiguration]::Default
$config = [PesterConfiguration]::new()
We could support all Pester options in an easier way than implementing $PSBPreference
settings for each of them individually by allowing users to provide their own Pester configuration like so...
# file: psakeFile.ps1
Properties {
$PSBPreference.Test.Configuration = New-PesterConfiguration -Hashtable @{
# Change defaults as needed. For example...
Run = @{
SkipRemainingOnFailure = 'Run'
}
}
}
There are some considerations though. For example, the advanced option allows providing multiple paths. Should PowerShellBuild be opinionated and aim to maintain the current test behavior by default? If PowerShellBuild overrides properties like Run.Path
, should the user be allowed to change that? How so?
Maybe other values from $PSBPreference.Test
should be used to override the user-supplied [PesterConfiguration]
and if they want to override those defaults, they should do it by updating the corresponding $PSBPreference.Test.*
property?