pester-patterns
Common Pester 5 test patterns and recipes for PowerShell module testing. Covers mocking file systems, REST APIs, DSC resources, databases, credentials, and other external dependencies. Provides ready-to-use test templates for common scenarios. USE FOR: Pester test patterns, mock file system, mock REST API, mock database, test DSC resource, test credentials, parametrized tests, Pester recipes, test template, testing patterns, how to test, mock example, run Pester, invoke tests, VS Code hang, separate process. DO NOT USE FOR: debugging failing builds (use sampler-build-debug), migrating to Sampler (use sampler-migration), general Pester syntax (covered by pester.instructions.md).
- Compatibility
- Requires PowerShell 5.1+ with Pester 5.
Pinned to revision 7a186c5dfcf8, so it is the text this page describes rather than whatever the author pushed since.
Files
- skills/pester-patterns/SKILL.md
- skills/pester-patterns/notes-evals.md
- skills/pester-patterns/references/migrating-pester-v4-to-v5.md
- skills/pester-patterns/references/mocking-external-dependencies.md
- skills/pester-patterns/references/testing-powershell-constructs.md
- skills/pester-patterns/scripts/Find-PesterV4Pattern.ps1
Every link opens the file at its source, pinned to the revision this page describes.