From a generated test to project coverage
A generated test file sitting in a tab is only interesting once. The Pester panel is what makes it part of a routine.
The panel (View menu, or it appears when there’s something to show) has four buttons that form a loop. Run these tests executes the generated file with your installed Pester, version 5 or later. Save test writes the file where Pester projects expect it, defaulting to Tests\Unit\<FunctionName>.Tests.ps1 under your project root, asking before overwriting. Refresh coverage audits the project root and lists which functions have tests and which don’t. Generate for all missing runs generation for the uncovered ones in a batch.
The tally line is written carefully. Freshly generated tests contain pending stubs, and a fresh run reports something like “0 failed · 6 skipped/pending.” Pending never counts as passing here. Fill a stub, run again, and watch the numbers move. When the run has failures the wording changes to say so.
A bug from our own history is relevant, because the fix explains how the pieces fit. Generated tests locate their source function through a $ProjectRoot parameter whose default assumes the test file sits in the conventional Tests\Unit\ location. Run these tests executes the unsaved buffer from a temporary folder, where that default points at nothing. For a while the run’s file-exists checks failed against a path that didn’t exist, making healthy generated tests look broken. Our sandbox UI tests caught it with an exact tally mismatch. The fix went in on both sides: generation now anchors to your saved file when the tab is saved, and the runner passes the true project root into the test’s parameter, which is the mechanism the generated files were designed around in the first place. You can run a generated file unsaved, saved, or from a CI checkout, and the answers match.
If Pester isn’t installed, the panel says exactly that, with the install command. And the saved file is ordinary Pester with no dependency on DetentShell. Invoke-Pester from any shell runs it identically. The panel is a convenience, not a lock-in.