Learn how to test your PowerShell exercises on Exercism
The exercises all use the Pester framework for mocking and testing.
All tests will be in a file named [Exercise].tests.ps1
as is the standard for the Pester framework.
If you're in the right directory (i.e. the one containing [Exercise].ps1
and [Exercise].tests.ps1
).
You can run the tests from PowerShell by calling:
Invoke-Pester
This will run all .tests.ps1
files it can find in the directory.
If you are using another shell than PowerShell, you can run the tests by calling:
pwsh -Command "Invoke-Pester"
You have to make sure you have the powershell extension installed in Visual Studio Code .
You can run tests in visual studio code in a couple of ways:
.Tests.ps1
script from the Debug menu. Keyboard short cuts are: F5
or Shift + F5
Describe
keyword in the test code itself