@nohwnd nohwnd released this Sep 13, 2017 · 103 commits to master since this release

Assets 2

There is a guide for migrating from Pester 3 to Pester 4 to help you understand how the changes from Pester 3 to Pester 4 might affect your tests.

What's new since 3.4.6:

  • Nested Describe{} and Context{}. Now you can group tests using as many Contexts{} and Describe{} blocks in any order. The use of mocks in Describe{} and Context{} blocks nested deeper than one of each is still unexplored territory, so proceed with an appropriate amount of caution. The same goes for -Tag, it only works on the top-level Describe/Context.
  • Improved and color-coded summaries output by Invoke-Pester. No more misreading that all your tests are failed!
  • Invoke-Pester now includes the name of the script it is currently executing. No more guessing which file a failed test is in!
  • New assertion syntax with assertions as parameters to Should, that allows richer assertion vocabulary. Instead of Should Not Be 10 you should write Should -Not -Be 10.
  • Custom Should operators. Use Add-AssertionOperator to write your own assertions. You could write an operator that allows you to write the working assertion $person | Should -BeAwesome.
  • Array assertions. Should now inspects array contents. For example, 1,2,3 | Should -Be 1,2,4 produces a user-friendly failure message. It even works recursively, so assertions like 1,@(2,3) | Should -Be 1,@(2,4) work.
  • Code coverage output in JaCoCo format. Use Invoke-Pester's -CodeCoverage and -CodeCoverageOutputFile parameters to produce code coverage reports that integrate with many CI tools.
  • Support for Gherkin.
  • Smaller distribution package. Files not necessary for end-users are now omitted from Pester packages.

Breaking changes:

  • Contain* assertions were renamed to FileContentMatch* to avoid confusing its behavior with -contains operator.
  • Assert-VerifiableMocks was renamed to Assert-VerifiableMock
  • Get-MockDynamicParameters was renamed to Get-MockDynamicParameter
  • Implementation of Mock changed significantly. That means you might observe some subtle differences in behavior. See the migration guide for more details.

Deprecated starting with 4.0.0:

  • The New-TestDriveItem command has been deprecated.
  • The -Quiet parameter of the Invoke-Pester command has been deprecated. Use -Show None instead.

Removed starting with 4.0.0:

  • The -OutputXml parameter of the Invoke-Pester command was deprecated already, now it has been removed. Use -OutputFormat and -OutputFile instead.