Skip to content

Releases: pester/Pester

5.2.0-beta1

24 Apr 06:54
Compare
Choose a tag to compare
5.2.0-beta1 Pre-release
Pre-release

5.2.0-beta1

Issues Fixed

  • Add $PesterBoundParameters to -MockWith and -ParameterFilter scriptblocks #1916
  • Fix mock behavior for Mock and Should -Invoke #1915
  • Resolve class metadata in the correct scope #1913
  • Add Pester assembly version check during module import #1790
  • Fix output of fullname filter in log #1893
  • Add New-PesterConfiguration cmdlet to create [PesterConfiguration] #1728
  • Disable CodeCoverage in CI switch #1911
  • Add option to throw on failure #1908
  • Rename Script.ps1 to Pester.ps1 #1907
  • Ensure plugins are null #1900
  • Isolate test files and scriptblocks to run in their it's own script scope #1889
  • Report failures in discovery into result object #1898
  • Fix setting passed on parent block when some blocks are not run #1897
  • Fix testdrive example #1894

See full log here

5.2.0-alpha3

29 Mar 20:22
Compare
Choose a tag to compare
5.2.0-alpha3 Pre-release
Pre-release

Issues Fixed

  • Coverage gutters #1887
  • In should Invoke, log output of parameter filter and variables we are redefining #1881
  • Exclude noisy Measure-SafeCommands rule by default #1882
  • Enable only discovery #1870
  • Useful string assert message #1880
  • Build locally without inlining #1872
  • Tiny readme fixes
  • Update readme.md #1874
  • Fix broken Version-property in Pester4Result object #1789
  • Initialize state in Invoke-Pester and inherit it to children #1869

See full log here

5.2.0-alpha2

07 Mar 20:45
Compare
Choose a tag to compare
5.2.0-alpha2 Pre-release
Pre-release

5.2.0-alpha2

  • See this to set code coverage target:
    #1866 (comment)

  • In Detailed output, full coverage report is printed.

  • CodeCoverage property added to -PassThru result.

Issues Fixed

  • Little improvements to coverage output #1866
  • Bunch bps and one hit bps #1865
  • Add Coverage to result object #1860

See full log here

5.2.0-alpha1

06 Mar 11:54
Compare
Choose a tag to compare
5.2.0-alpha1 Pre-release
Pre-release

5.2.0-alpha1

Issues Fixed

  • Bump to 5.2.0-alpha1
  • Fix wildcards in dirs #1858
  • Fix searching for mock table when deep in tests #1856
  • Fix conflicting name "arguments" in parameter filter #1855
  • Fix interactive execution of parameterized tests #1787
  • Fix default InModuleScope args-value #1812
  • Fix missing initial value for Data in Invoke-File #1852
  • Fix missing LICENSE file in Nuget package (#1839) #1840
  • Fix blank code coverage 1621 #1807
  • Replace non-breaking spaces (ascii code 160) with regular spaces (ascii code 32). Fixes #1820. #1823
  • Fixed type in README.md #1834
  • Set 20 minute timeout for tests
  • fixed typo in the examples of Invoke-Pester #1841
  • Fix typo #1844
  • Merge branch 'rel/5.1.1xx' into v5.0
  • Fix safecomands spelling #1800
  • Bump branding to 5.2.0-beta1

See full log here

5.1.1

11 Dec 10:20
Compare
Choose a tag to compare

Issues Fixed

  • Fix help for Invoke-Pester #1792
  • Fix exit #1797
  • Cleanup command reference help and add online help link #1806
  • Fix NUnit2.5 option #1796
  • Fix index error when using Get-Command on Should #1804

See full log here

5.1.0

25 Nov 10:19
Compare
Choose a tag to compare

5.1.0

First of all, huge thanks to @fflaten who contributed a huge amount of code, bug fixing, issue responses, and improvements in this and previous releases. 🍾🥂

Also thanks to all other contributors who contributed by reporting and fixing bugs, posting PRs, discussing features, or just by sharing their opinion.

Catching up with v4

Parametrized scripts

Passing parameters to scripts works again. Read all about it, and how to generate tests in https://pester.dev/docs/usage/data-driven-tests.

New-Fixture is back

New-Fixture was added back into Pester v5, with a better behavior. It will now fail by default to show you that you did not complete the template.

Updated help

Help was updated both on function and in the usage docs on Pester docs site, including sections specific for migrating from Pester v4. See:

JUnit output is working again

JUnit output for Pester results is available again. And NUnit output is fixed.

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

See https://pester.dev/docs/usage/data-driven-tests for even more info on this.

Smaller improvements

  • Add missing and update help for exported functions #1785
  • Add JUnit XML output #1748
  • Always set exit code exit #1734
  • Print active filters in Detailed/Diagnostic output #1727
  • Re-implement New-Fixture in Pester v5 #1726
  • Add support for VSCode problem-tracking for failed assertions #1700
  • Allow AfterAll in top-level #1707
  • Throw when legacy syntax is used #1706
  • Remove pipeline support from Should -Invoke #1698
  • 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 devcontainer to project #1661
  • Parametric scripts #1671

See full log here

5.1.0-rc2

19 Nov 11:08
Compare
Choose a tag to compare
5.1.0-rc2 Pre-release
Pre-release

Issues Fixed

  • Fix interactive execution bug in VSCode #1773
  • Test for passing params to It wihout any foreach #1776
  • Updated New-Fixture template to throw by default #1775
  • Compact GitHub templates #1774

See full log here

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