Skip to content

Releases: pester/Pester

4.4.3

11 Dec 19:58
Compare
Choose a tag to compare

What is new since 4.4.2?

Signed

The module is now signed so first installation on Windows 10 does not show a huge red error anymore. 🔑 📦 🎉

This is how the installation looks like when installed over Pester 3.4.0 that ships with Windows 10:
4 4 3_nonverbose
The same but with -Verbose:
4 4 3

This is how the installtion used to look like:
4 4 2

Other fixes

  • Bug where the module failed to load because id and uname is symlinked from multiple places was fixed, so Pester is now usable on CentOS and can print more detailed info in the TestReport.
  • Custom Should operators can define multiple aliases.

4.4.2

03 Oct 17:33
Compare
Choose a tag to compare

What is new since 4.4.1

  • Single quotes are no longer added around strings that are expanded in test names. (e.g. from TestCases).
  • On non-windows platforms, we try to get environment info.

4.4.1

29 Sep 07:46
Compare
Choose a tag to compare

What is new since 4.4.0

  • Fix filtering by tags. In the previous version all non-tagged tests were run all the time.

  • Fix parameter name capitalization.

4.4.0

20 Jul 11:09
Compare
Choose a tag to compare

What is new since 4.3.1

  • All mocks are deleted at the start of the test run to prevent breaking down when tests were terminated in the middle of the run.

  • Output the error that fails Should -Not -Throw assertion.

Breaking changes

  • Tags used to split on spaces, but now they don't anymore. No-one was most likely using this feature. If you did, move on to proper array of tags, instead of a single string with spaces.

4.4.0-beta

06 May 18:28
Compare
Choose a tag to compare
4.4.0-beta Pre-release
Pre-release

Many small changes, but three are important:

  • Tags can use -like wildcards: #504

  • Wording fixes in BeGreater* BeLess* assertions to actually make sense: #1032

  • Mocks are not as easy to corrupt now, all left-over mock aliases and functions are cleaned up on Pester start:
    #913

4.3.1

20 Feb 22:04
Compare
Choose a tag to compare

What is new since 4.2.0

  • Improved output, that expands $true, $false, $null, collections, dates and so on, to make the results of assertions, and test case expansions much easier to read.
Describing new assertion output
  [-] strings now have single quotes like 'this' 63ms
    Expected strings to be the same, but they were different.
    String lengths are both 4.
    Strings differ at index 0.
    Expected: ' abc'
    But was:  'abc '
    -----------^
    5:         'abc ' | Should -Be " abc"
  [-] empty string and null became <empty> and $null 36ms
    Expected <empty>, but got $null.
    9:         $null | Should -Be ''
  [-] numbers have nothing around them 30ms
    Expected 0, but got 1.
    13:         1 | Should -Be 0
  [-] decimals and doubles use point 0.1 45ms
    Expected 0, but got 0.1.
    17:         0.1 | Should -Be 0
  [-] booleans are written as $true and $false 71ms
    Expected $false, but got $true.
    21:         $true | Should -Be $false
  [-] dates are expanded to include ticks 83ms
    Expected 0001-01-01T00:00:00.0000000, but got 2018-02-20T18:39:15.7773648+01:00.
    25:         (Get-Date) | Should -Be ([datetime]::MinValue)
  [-] collections are wrapped in @() 49ms
    Expected an empty collection, but got collection with size 3 @(1, 2, 3).
  • There are now tests that make sure that we have comprehensive help.

(The version 4.3.0 was briefly published, but dependencies were missing from the package, so a new version had to be published. That is why this is both minor and patch bump.)

Breaking changes

  • None, unless you depend on the exact wording of our assertion messages.

4.2.0

18 Feb 12:53
Compare
Choose a tag to compare

This release focuses primarily on making assertions better, even thought there are other small fixes and updates.

What's new since 4.1.1:

New assertions

  • There are now Should -BeLessThan and Should -BeLessOrEqual assertions to complement the existing BeGreaterThan and BeGreaterOrEqual assertions.

  • Should -Contain assertion was added that operates on collections, the same way the -contains operator operates on them.

    1,2,3 | Should -Contain 1
  • Should -HaveCount was added that counts items in a collection
1,2,3 | Should -HaveCount 3
  • Should -BeTrue and Should -BeFalse were added to assert on truthy and falsy values
$true | Should -BeTrue
1 | Should -BeTrue

$false | Should -BeFalse
0 | Should -BeFalse

Assertion improvements

  • Every built in assertion allows you to specify -Because parameter, to give more meaning to your tests.
function Get-Group { $null }
$groups = 1..10 | Get-Group -Size 3
$groups | Should -HaveCount 4 
    `-Because "because 10 items are split into three groups with 3 members and one extra group with 1 member"

Which fails with:

Expected a collection with size {4}, 
because 10 items are split into three groups with 3 members and one extra group with 1 member, 
but got collection with size {1} [].
  • Should -Throw has -ExceptionType parameter that matches the exception type and any of its subtypes.
function a () { throw [System.ArgumentNullException]"argument is null" }

# this passes because, ArgumentNullException inherits from ArgumentException
{ a } | Should -Throw -ExceptionType ([ArgumentException])

# this fails, because ArgumentNullExcption does not inherit from InvalidOperationException
{ a } | Should -Throw -ExceptionType ([InvalidOperationException])
  • Should -Throw has -PassThru parameter that returns the caputed exception to output. This is useful for catching a complex exception and further inspecting it.
$err = { 
    throw (New-Object System.InvalidOperationException "Something wrong happened",
            (New-Object DivideByZeroException "you divided by zero")
          )
 } | Should -Throw -PassThru
$err.Exception.InnerException.Message | Should -Be "you divided by zero"
  • Should -BeOfType is now aliased to -HaveType
1 | Should -HaveType [int]

Breaking changes:

  • Should -Not -Throw will fail if any exception is thrown. The filters applied on Should -Not -Throw do not apply, because when an exception is thrown, it automatically means that the test should not pass.

4.1.1

09 Dec 13:25
Compare
Choose a tag to compare

What's new since 4.1.0:

  • The packages deployed to Nuget and Chocolatey are fixed. Before they were missing Gherkin.dll.

4.1.0

15 Nov 13:09
Compare
Choose a tag to compare

What's new since 4.0.8:

  • Pester now runs on Linux and macOS! 🎉 🍾 Big thanks to @it-praktyk for making it possible.
  • There are some limitations when running Linux and macOS (or more broadly speaking on PSCore), go here to learn more.

Breaking changes:

  • Minor release is not a good place to introduce breaking changes, but we had to do it anyway, sorry. The progress bar is no longer used to show which test is running. The other output works as before. The reason to remove the progress bar was that it causes performance issues (huge ones on TravisCI). A replacement functionality, that will be less flashy, and more CI friendly will be introduced soon. To track status see #939.

4.0.8

15 Sep 18:41
Compare
Choose a tag to compare

Function Assert-VerifiableMocks that throws an exception is added back to Pester to avoid loading older version of the module and failing with a cryptic message.