Pester tests for PowerShell scripts used by OneBranch pipeline steps.
- PowerShell 5.1+ or PowerShell 7+
- Pester v5 (
Install-Module Pester -MinimumVersion 5.0 -Scope CurrentUser)
From this directory:
Invoke-Pester ./publish-symbols.Tests.ps1Or from the repository root:
Invoke-Pester ./eng/pipelines/onebranch/scripts/tests/For detailed output:
Invoke-Pester ./publish-symbols.Tests.ps1 -Output Detailed| Area | What's tested |
|---|---|
| Version computation | Canonical output parsing, revisions, wrapping, effective package selection, and failures |
| Localization validation | Missing, obsolete, or empty strings, English-value matches, and culture-specific allowlisting |
| Parameter validation | Empty strings rejected for all mandatory parameters |
| URL construction | Base URL, register URL, request URL built from parameters |
| Request bodies | Registration body, default publish flags, flag overrides |
| Error handling | Token failure, registration failure, publish failure, status failure — all verify expanded URI in error message |
| Status validation | Detects Failed/Cancelled results, respects PublishToInternal/PublishToPublic flags, passes on Succeeded/Pending |
- All external calls (
az,Invoke-RestMethod) are mocked — no network access or Azure credentials are required. - Version tests mock
dotnet, so they do not invoke MSBuild or require a restored repository. - Tests validate scripts in the parent directory relative to this directory.