psake / PowerShellBuild

Common build tasks for psake and Invoke-Build that build and test PowerShell modules
MIT License
133 stars 24 forks source link

Pester tests attempted despite value of $PSBPreference.Test.Enabled #20

Closed pauby closed 4 years ago

pauby commented 5 years ago

Despite the value of $PSBPreference.Test.Enabled, Pester tests are executed.

Expected Behavior

If $PSBPreference.Test.Enabled is set to $false then Pester tests should not be run.

Current Behavior

Pester tests are run regardless of the setting.

Possible Solution

I would have said that inside the Pester task there should be a check for the $PSBPreference.Test.Enabled value being $true. However there is a $pesterPreReqs scriptblock that is executed in the psakeFile.ps1 as a precondition but this is not being carried over to InvokeBuild (perhaps using an -If) which is where I believe the issue is.

Your Environment