Skip to content

Releases: pester/Pester

5.1.0-rc1

07 Nov 11:21
Compare
Choose a tag to compare
5.1.0-rc1 Pre-release
Pre-release

5.1.0-rc1

Issues Fixed

  • Remove Bug label from issue #1762
  • Fix output when -ForEach is used with a block #1760

See full log here

5.1.0-beta4

01 Nov 12:59
Compare
Choose a tag to compare
5.1.0-beta4 Pre-release
Pre-release

5.1.0-beta4

Notable changes

  • Add JUnitXML output
  • Rename New-TestContainer to New-PesterContainer

Issues Fixed

  • Fix JUnit counts for skipped and notrun #1758
  • Fix path in NUnit #1755
  • Fix joining fallback ExpandedPath #1754
  • Add JUnit XML output #1748
  • Disable CC in build to make it much faster #1751
  • Create CODE_OF_CONDUCT.md and SECURITY.md #1676
  • Cleanup alias and missing SafeCommands #1745
  • Removed test-step in PR template #1749
  • Rename New-TestContainer to New-PesterContainer and fix Run.Container usage #1743
  • Add labels to templates #1742
  • Update github templates #1739

See full log here

5.1.0-beta3

25 Oct 08:01
Compare
Choose a tag to compare
5.1.0-beta3 Pre-release
Pre-release

5.1.0-beta3

Issues Fixed

  • Add CONTRIBUTING.md (renames BUILD.md) #1697
  • Always set exit code exit #1734
  • Print active filters in Detailed/Diagnostic output #1727
  • Default mock args to empty array #1730
  • Update devcontainer #1729
  • Re-implement New-Fixture in Pester v5 #1726
  • Update README.md
  • Clean up mocks in the session state where we defined them #1725
  • Default to expanded name and path #1718
  • Write all parent blocks to screen on first test or on failed block #1717
  • Add support for VSCode problem-tracking for failed assertions #1700

See full log here

5.1.0-beta2

07 Oct 08:36
Compare
Choose a tag to compare
5.1.0-beta2 Pre-release
Pre-release

5.1.0-beta2

Issues Fixed

  • Allow AfterAll in top-level #1707
  • Throw when legacy syntax is used #1706
  • Added Get-AstTopParent fn, ignore pipeline parts #1656
  • Fix should help examples #1647
  • Remove pipeline support from Should -Invoke #1698
  • Create SUPPORT.md #1677

See full log here

5.1.0-beta1

18 Sep 16:45
Compare
Choose a tag to compare
5.1.0-beta1 Pre-release
Pre-release

New features

BeforeDiscovery block

BeforeDiscovery is a semantic block that allows you to group your code together if you need it to run during discovery. It just takes your code and runs it in place. But it gives a nice way of showing that this code is here intentionally, and not just a forgotten piece of code that you did not migrate to Pester v5.

BeforeDiscovery { 
    $testConfigs = Get-ChildItem -Path $PSScriptRoot/TestConfigs
}

Describe "Platform dependent tests" {
    foreach ($config in $testConfigs) {
        It "Runs for config $($config.Name)" { 
            # ...
        }
    }
}

"TestCases" for Describe and Context

-ForEach parameter was added to Describe and Context, and also to It as an alias for -TestCases. Like -TestCases on It you can use this to create one block for each example.

This has been long awaited and this thread has a lot of examples of the usage. #1679

This can also be used with the parameters that you provide directly to the script which was introduced in the previous preview. See example of the usage in the thread. #1679 (comment)

"TestCases" can take any array, not just arrays of hashtables

You can now provide any array to -TestCases / -ForEach, and it will be defined as $_ in your tests. Additionally if your array is an array of hashtables, each key in that hashtable will be expanded to a variable, the same way it already works for -TestCases.

(Just don't use _ as the name of any Key in your hashtable, it won't work well.

Templates expand to all variables and allow dot-notation

Using this syntax <user>, that you know from -TestCases you can now expand value from any variable that is defined in the scope, not just from the provided hashtable. You can use <_> to expand the $_. You can also use dot-notation <user.name>, to navigate into the object. Here an example of the dot-notation in action:

Describe "<animal.name>" -ForEach @(
    @{
        Animal = @{
            Name = "dog"
            Sounds = @("woof", "barf")
        }
    }
    @{
        Animal = @{
            Name = "cat"
            Sounds = @("meow", "purr")
        }
    }
    ) {

    It "<animal.name> goes <_>" -ForEach $Animal.Sounds {

    }
}
Starting discovery in 1 files.
Discovering in C:\Users\jajares\Desktop\ex.tests.ps1.
Found 4 tests. 48ms
Discovery finished in 61ms.

Running tests from 'C:\Users\jajares\Desktop\ex.tests.ps1'
Describing dog
  [+] dog goes woof 10ms (4ms|5ms)
  [+] dog goes barf 11ms (2ms|8ms)

Describing cat
  [+] cat goes meow 8ms (2ms|7ms)
  [+] cat goes purr 8ms (5ms|3ms)
Tests completed in 370ms

Issues Fixed

  • Filter excluded tests from NUnit results #1686
  • Add -ForEach parameter to Describe, Context, and as an alias to -Test… #1681
  • Add BeforeDiscovery semantic block #1680
  • Add fallback startline #1678

See full log here

5.0.5-beta1

04 Sep 14:57
1fdd40a
Compare
Choose a tag to compare
5.0.5-beta1 Pre-release
Pre-release

5.0.5-beta1

Issues Fixed

  • Add devcontainer to project #1661
  • Parametric scripts #1671
  • Make switches not mandatory #1610

🌵 Looking for feedback for fa7081d which adds the possibility to parametrize scripts by creating New-TestContainer with associated data, and passing it via -Container or PesterConfiguration.Run.Container.

See full log here

5.0.4

03 Sep 09:31
Compare
Choose a tag to compare

5.0.4

Issues Fixed

  • Add basic elipsis to indicate the array was shortened #1672
  • Fix line-based filter for tests with multiline testcases #1664
  • Removed unused variable #1663
  • Update README.md #1652
  • Add support for "-Not" to "Should -Invoke" tests #1665
  • Update invoke-pester help to improve #1634 #1648
  • Update README.md #1666
  • Fix conflicting tests #1658
  • Add nugets and publish to nuget and choco #1654

See full log here

5.0.3

08 Aug 08:04
Compare
Choose a tag to compare
  • fix formatting for Nunit parameterrized tests #1630
  • Add FullNameFilter and PassThru parameters to Simple interface parameter list in README.md #1637
  • Fixes #1631 - Updated docs Planets example to work with Pester v5 #1632
  • Fix basic scoping of BeforeAll #1636
  • (doc): Add Legacy v4 parameter mapping to config object in README.md #1595

See full log here

5.0.2

02 Jun 16:56
Compare
Choose a tag to compare
  • Allow splatting to Should again
  • Fix Add-ShouldOperator error when importing Pester v5 in session that has v4
  • Fix mocking Test-Path
  • Make -OutputPath in the Legacy set non-mandatory

5.0.1...5.0.2

5.0.1

28 May 10:44
Compare
Choose a tag to compare

The Parameters of Invoke-Pester changed significantly from v4. This release adds a compatibility parameter set.

It should be possible to use all v4 parameters to Invoke-Pester:

Invoke-Pester -Script $testFile -PassThru -Verbose -OutputFile $tr `
    -OutputFormat NUnitXml -CodeCoverage "$tmp/*-*.ps1" `
    -CodeCoverageOutputFile $cc -Show All

The compatibility is not 100%:

  • neither -Script not -CodeCoverage take hashtables, they just take a collection of paths. This is scheduled for 5.1.0.

  • The -Strict parameter and -PesterOption are ignored. Strict will possibly be fixed in 5.1.0 as well. -PesterOption is superseded by -Configuration, and you most likely don't need it in your workflow right now.

  • The -Output \ -Show parameter takes all the values of v4.

    • but translates only the most used options to Pester 5 compatible options. Otherwise it uses Detailed output.
    • It also allows all the Pester 5 output options, to allow you to use Diagnostic during migration.
    • This whole Parameter set is deprecated, and prints a warning.

For more options and the Advanced interface see simple and advanced interface above on how to invoke Pester.