Search code examples
powershellpester

Pester custom error text


Does anyone know if Pester supports custom error texts?

Lets say I've the following test:

Describe "Get-HelloWorld" {
    It "outputs 'Hello world!'" {
        Get-HelloWorld | Should Be 'Hello world!'
    }
}

Is there a way that I can set some custom error message if Get-HelloWorld returns another string than "Hello World"?

Thx


Solution

  • The latest version of Pester supports -Because where you can add some custom text that explains the purpose of the test.