-
Notifications
You must be signed in to change notification settings - Fork 8
Pester Task
The Pester
task runs tests using Pester 5. You pass a hashtable of parameters to the Configuration
property that gets casted into a Pester-Configuration. Pester-Configuration contains parameters such as Run.Path
, Run.ExcludePath
, TestResults.Enabled
. You can also pass a hashtable of parameters to the Container
property that gets casted into a Pester-Container. The Pester-Container can either be a container or a script block, either of which can be ran with or without data.
Test reports are saved to the output directory in NUnit XML format. The report files are named pester+RANDOM_STRING.xml
, where RANDOM_STRING
is a random strings of characters.
-
AsJob
: by default, the task runs Pester in Whiskey's private scope. Otherwise, tests run in a background job/process. If you don't want to run in Whiskey's private scope, set this totrue
. -
Configuration
: a hashtable of parameters that contains variables such asRun.Path
,Run.ExcludePath
,TestResults.Enabled
, etc... This hashtable is then converted to a Pester-Configuration. -
Container
: a hashtable of parameters that contains either a container or a script block, either of which can be with or without data. This hashtable is then converted to a Pester-Container.
Build:
- Pester:
Configuration: @{ Run = @{ Path = 'Test\*.ps1'; }; }
Demonstrates how to run Pester tests using Pester 5. In this case, all the tests in files that match the wildcard Test\*.ps1
are run.
Build:
- Pester:
Configuration: @{ Run = @{ Path = 'Test\*.ps1'; ExcludePath = '*\\*Pester*.ps1'; }; }
Demonstrates how to use the Pester Configuration's ExcludePath
property to exclude tests from running. In this example, all tests in the Tests directory that end in ".Tests.ps1" except files whose base names contain "Pester" will be run.
Build:
- Pester:
Configuration: @{ Run = @{Path = 'Test\*.ps1'; }; TestResult = @{ Enabled = $true; }; }
Demonstrates how to use the Pester Configuration's TestResult
property to produce test results for all the tests in files that match the wildcard Test\*.ps1
.
- Common Task Properties
- AppVeyorWaitForBuildJob
- CopyFile
- Delete
- DotNet
- Exec
- File
- GetPowerShellModule
- GitHubRelease
- InstallNodeJs
- LoadTask
- Log
- MergeFile
- MSBuild
- NuGetPack
- NuGetPush
- NuGetRestore
- NUnit2
- NUnit3
- Parallel
- Pester
- Pipeline
- PowerShell
- ProGetUniversalPackage
- PublishBitbucketServerTag
- PublishBuildMasterPackage
- PublishNodeModule
- PublishPowerShellModule
- PublishProGetAsset
- PublishProGetUniversalPackage
- SetVariable
- SetVariableFromPowerShellDataFile
- SetVariableFromXml
- TaskDefaults
- Version
- Zip