Team Ai
Datasetpublic

MegaBites-AI/Windows-powershell

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes372downloads
README.md48 linesDownload Raw Back to powershell
1# Pester Testing Test Guide2 3Also see the [Writing Pester Tests](../../docs/testing-guidelines/WritingPesterTests.md)4document.5 6## Running Pester Tests7 8Go to the top level of the PowerShell repository and run: `Start-PSPester`9inside a self-hosted copy of PowerShell.10 11You can use `Start-PSPester -Tests SomeTestSuite*` to limit the tests run.12 13## Testing new `powershell` processes14 15Any launch of a new `powershell` process must include `-noprofile` so that16modified user and system profiles do not causes tests to fail. You also must17take care to call the development copy of PowerShell, which is *not* the first18one on the path.19 20Example:21 22```powershell23    $powershell = Join-Path -Path $PsHome -ChildPath "pwsh"24    & $powershell -noprofile -command "ExampleCommand" | Should Be "ExampleOutput"25```26 27## Portability28 29Some tests simply must be tied to certain platforms. Use Pester's30`-Skip` directive on an `It` statement to do this. For instance to run31the test only on Windows:32 33```powershell34It "Should do something on Windows" -Skip:($IsLinux -Or $IsMacOS) { ... }35```36 37Or only on Linux and OS X:38 39```powershell40It "Should do something on Linux" -Skip:$IsWindows { ... }41```42 43## Pending44 45When writing a test that should pass, but does not, please do not skip or delete46the test, but use `It "Should Pass" -Pending` to mark the test as pending, and47file an issue on GitHub.48