pester

SKILL.md

Pester Unit Testing for PowerShell

Pester is PowerShell's ubiquitous test and mock framework. Pester 5+ uses a two-phase execution model (Discovery → Run) that requires specific patterns for reliable tests.

TDD Cycle

  1. Red – Write a failing test describing expected behavior
  2. Green – Implement minimal code to pass
  3. Refactor – Clean up while keeping tests green

Test File Structure

Test files use *.Tests.ps1 naming convention. Place alongside source files:

src/
├── Get-Widget.ps1
└── Get-Widget.Tests.ps1
Installs
3
First Seen
Apr 15, 2026
pester from smithery.ai