Clarify that Set-ItResult ends the It block in Pester v5 Skip section (#1857)

Set-ItResult -Skipped/-Inconclusive throws internally to end the It block, so code after it does not run and a trailing return is unreachable. Documenting this prevents the recurring suggestion to add a redundant return after Set-ItResult.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Trent Blackburn
2026-05-28 01:05:02 -04:00
committed by GitHub
parent a3f54b1cd8
commit 70209f3dfd
@@ -121,6 +121,7 @@ Invoke-Pester -TagFilter 'Unit' -ExcludeTagFilter 'Slow'
- **`-Skip`**: Available on `Describe`, `Context`, and `It` to skip tests
- **Conditional**: Use `-Skip:$condition` for dynamic skipping
- **Runtime Skip**: Use `Set-ItResult -Skipped` during test execution (setup/teardown still run)
- **Ends the test body**: `Set-ItResult -Skipped`/`-Inconclusive` throws internally to end the `It` block, so code after it does not run; a trailing `return` is unreachable and should not be added
```powershell
It 'Should work on Windows' -Skip:(-not $IsWindows) { }