Releases: pester/Pester
5.6.0-rc1
What's Changed
Inconclusive is back!
- Set-ItResult: Return distinctive ErrorId depending on switch used by @csandfeld in #2401
- Handle tests marked as inconclusive by @csandfeld in #2405
- Add missing help for -Skip in Context and Describe by @fflaten in #2426
Should -HaveParameter regression is fixed.
And more:
(in beta1)
- fixed typo in property params in TestReults.ps1 by @stan-alam in #2397
- Update code-analysis workflow to node20 actions by @fflaten in #2429
- Update PesterTests and devcontainer to .NET 8 by @fflaten in #2430
- Update coverage publish task by @nohwnd in #2433
- Fix docs for FileContentMatchMultiline* operators by @fflaten in #2377
- Extract common helper-functions in P-tests by @fflaten in #2378
- Feature Request: ShouldResult property by @JustinGrote in #2381
- Replace Id with GroupId in Block and Test objects by @fflaten in #2364
(in rc1)
- Standardize container name and type validation by @fflaten in #2379
- Fix WildcardPatternException when using dt in P by @fflaten in #2443
- Fix possible NRE in NUnit3 export by @fflaten in #2444
- Skip blocks without runnable tests by @fflaten in #2447
- Ignore excluded/skipped tests and unnecessary setup/teardown using SkipRemainingOnFailure by @fflaten in #2442
New Contributors
- @stan-alam made their first contribution in #2397
And also a big thank you to @fflaten!
Contrary to my tweet, we won't remove support for 3, 4, and 6.2 in Pester 5, the PR was added and then reverted. Will keep that change for Pester 6.
- Drop support of PowerShell 3, 4, 6.2, and unsupported 7 by @nohwnd in #2432
- Revert dropping support of Powershell 3 and friends by @nohwnd in #2435
Error on update:
My certificate was renewed, and you will get error on update, because the Issuer changed. And there is no way to get valid certificate from the previous issuer. It is still signed by me, but don't take my word for it, go check the certificate.
Full Changelog: 5.6.0-beta1...5.6.0-rc1
5.6.0-beta1
What's Changed
Inconclusive is back!
- Set-ItResult: Return distinctive ErrorId depending on switch used by @csandfeld in #2401
- Handle tests marked as inconclusive by @csandfeld in #2405
- Add missing help for -Skip in Context and Describe by @fflaten in #2426
Should -HaveParameter regression is fixed.
And more:
- fixed typo in property params in TestReults.ps1 by @stan-alam in #2397
- Update code-analysis workflow to node20 actions by @fflaten in #2429
- Update PesterTests and devcontainer to .NET 8 by @fflaten in #2430
- Update coverage publish task by @nohwnd in #2433
- Fix docs for FileContentMatchMultiline* operators by @fflaten in #2377
- Extract common helper-functions in P-tests by @fflaten in #2378
- Feature Request: ShouldResult property by @JustinGrote in #2381
- Replace Id with GroupId in Block and Test objects by @fflaten in #2364
New Contributors
- @stan-alam made their first contribution in #2397
And also a bit thank you to @fflaten!
Contrary to my tweet, we won't remove support for 3, 4, and 6.2 in Pester 5, the PR was added and then reverted. Will keep that change for Pester 6.
- Drop support of PowerShell 3, 4, 6.2, and unsupported 7 by @nohwnd in #2432
- Revert dropping support of Powershell 3 and friends by @nohwnd in #2435
Error on update:
My certificate was renewed, and you will get error on update, because the Issuer changed. And there is no way to get valid certificate from the previous issuer. It is still signed by me, but don't take my word for it, go check the certificate.
Full Changelog: 5.5.0...5.6.0-beta1
5.5.0
What's Changed
- Add support for NUnit3 XML-reports by @fflaten in #2208
- Add -InParameterSet in Should -HaveParameter by @fflaten in #2273
- CI Treat Errors As Warnings - ref #2295 by @erikgraa in #2296
- Add missing container-parameters to Data before BeforeDiscovery by @fflaten in #2361
- Fix ANSI sequence shown in Azure DevOps summary by @fflaten in #2352
- Support Should -HaveParameter -DefaultValue for AliasInfo and scripts by @fflaten in #2353
- Update error messages in Should -Throw by @fflaten in #2354
- Fix parameter default values leaking to Data in user-provided Container by @fflaten in #2362
- Rename TestCases parameter to ForEach by @nohwnd in #2311
Pester in Pester
- Do not cleanup previous mocks in inner Invoke-Pester by @fflaten in #2337
- Reattach TestDrive and TestRegistry after running inner Invoke-Pester by @fflaten in #2341
Perf
Internal fixes
- Support building assembly with Debug configuration by @fflaten in #2339
- Address analyzer suggestions for csharp-project by @fflaten in #2307
- Add Run.Exit option clarification by @nohwnd in #2346
- Fix false errors and broken CI-logs from P-tests by @fflaten in #2345
- Upgrade to action/checkout v3 in PSSA workflow by @fflaten in #2351
- Change sponsoring in readme by @nohwnd in #2363
- Refactor Invoke-Pester and validate configuration early by @fflaten in #2317
- Reorganize TestResuls-code into format-specific files by @fflaten in #2348
New Contributors
Full Changelog: 5.4.1...5.5.0
5.5.0-rc1
What's Changed
- Add support for NUnit3 XML-reports by @fflaten in #2208
- Add -InParameterSet in Should -HaveParameter by @fflaten in #2273
- CI Treat Errors As Warnings - ref #2295 by @erikgraa in #2296
- Avoid nested array when using Should -ActualValue by @fflaten in #2315
- Add missing container-parameters to Data before BeforeDiscovery by @fflaten in #2361
- Fix ANSI sequence shown in Azure DevOps summary by @fflaten in #2352
- Support Should -HaveParameter -DefaultValue for AliasInfo and scripts by @fflaten in #2353
- Update error messages in Should -Throw by @fflaten in #2354
- Fix parameter default values leaking to Data in user-provided Container by @fflaten in #2362
- Rename TestCases parameter to ForEach by @nohwnd in #2311
Pester in Pester
- Do not cleanup previous mocks in inner Invoke-Pester by @fflaten in #2337
- Reattach TestDrive and TestRegistry after running inner Invoke-Pester by @fflaten in #2341
Perf
Internal fixes
- Support building assembly with Debug configuration by @fflaten in #2339
- Address analyzer suggestions for csharp-project by @fflaten in #2307
- Add Run.Exit option clarification by @nohwnd in #2346
- Fix false errors and broken CI-logs from P-tests by @fflaten in #2345
- Upgrade to action/checkout v3 in PSSA workflow by @fflaten in #2351
- Change sponsoring in readme by @nohwnd in #2363
- Refactor Invoke-Pester and validate configuration early by @fflaten in #2317
- Reorganize TestResuls-code into format-specific files by @fflaten in #2348
New Contributors
Full Changelog: 5.4.1...5.5.0-rc1
5.4.1
What's Changed
Fixes
- Fix Format-Collection for ICollection by @fflaten in #2265
- Improve error when -HaveParameter is used with mock or alias for local function by @fflaten in #2233
- HaveParameter is not dependent on format of param block by @brianwest in #2288
- Fix script parameter leaking to another container with same Data by @fflaten in #2302
- Include expected type in exceptions when type is not resolvable by @fflaten in #2271
- Measure AfterAll and AfterEach as UserDuration by @fflaten in #2313
- Update New-MockObject help by @fflaten in #2323
- Fix docs typos by @martincostello in #2326
- Replace ErrorAction SilentlyContinue with Ignore by @fflaten in #2318
- Quote input string in BeNullOrEmpty error by @fflaten in #2329
- Remove parameter attributes in reverse in Mock by @fflaten in #2334
- Support profiling Pester with CC using Profiler v3.1 or v4 by @fflaten in #2321
Performance
Internal fixes
- Use encodedCommand in Invoke-InNewProcress for P-tests by @fflaten in #2267
- Bump psmodulecache action to v5.2 by @fflaten in #2287
- Increase timeout in CI build step by @fflaten in #2316
- Fix typos in Pester.BuildAnalyzerRules by @fflaten in #2305
- Correct typos in comments by @alexandear in #2294
New Contributors
- @brianwest made their first contribution in #2288
- @martincostello made their first contribution in #2326
- @alexandear made their first contribution in #2294
Full Changelog: 5.4.0...5.4.1
5.4.0
In this release there are many fixes and improvements thanks @fflaten to providing most of them!
ANSI colors for output
Output is now printed with colors in AzureDevOps:
To achieve that, Pester detects if the host supports ANSI codes and uses them to output the string. You can control this by this new option:
[PesterConfiguration]::Default.Output.RenderMode
Default Description Value
------- ----------- -----
Auto The mode used to render console output, options are Auto, Ansi, ConsoleColor and Plaintext. Auto
And optionally switch back to classical ConsoleColor, or a new PlainText mode that outputs just text without any embedded formatting.
Check Multiple aliases for Should -HaveParameter
Should -HaveParameter
can now ensure that there are multiple aliases set for a parameter.
function f {
param( [Alias('UserName')] $Name )
$Name
}
Get-Command f | Should -HaveParameter Name -Alias 'n', 'UserName'
InvalidResult:
Line |
1 | Get-Command f | Should -HaveParameter Name -Alias 'n', 'UserName'
| Expected command f to have a parameter Name, with aliases 'n' and 'UserName',
| but it didn't have an alias 'n'.
- Add support for multiple aliases (-Alias) to Should -HaveParameter by @dtewinkel in #2247
Always return to the original path
Pester captures the current path in which Invoke-Pester
is invoked, and returns to this path after the execution of the test, even if the tests change it:
PS C:\projects\myModule> Invoke-Pester -Container (
New-PesterContainer -ScriptBlock {
Describe "d" {
It "i" {
Set-Location C:\Windows
}
}
})
This will return back to C:\projects\myModule
after your tests finish running.
Mocking in Manifest Modules
Mock, Should -Invoke and InModuleScope are now allowed for manifest modules.
Additional changes and improvements
-
Add Should-example for exception-assertion by @fflaten in #2171
-
Fix mocks with enum-parameters and ValidateRange by @fflaten in #2191
-
Don't run Get-CimInstance on Nanoserver by @irishismyname in #2192
-
Exit invoked testfile after interactive execution by @fflaten in #2218
-
Fix hang in New-TestRegistry when access is denied by @fflaten in #2236
-
Add support for assigning lists to StringArrayOption by @fflaten in #2232
-
Throw in Add-ShouldOperator when max number of operators is reached by @fflaten in #2231
-
Validate Should -Invoke is invoked in specified -Scope blocktype by @fflaten in #2230
-
Add -Because to Should -Invoke and -InvokeVerifiable by @fflaten in #2229
-
Fix NRE when assigning null to arrayoption in hashtable by @fflaten in #2219
-
Fix module installation in PowerShell 3 and 4 by @fflaten in #2214
-
Add help for dynamic operator parameters by @fflaten in #2170
-
Support int and double values when merging decimaloption by @fflaten in #2186
-
Update ExpandedPath before executing tests and blocks by @fflaten in #2254
Internal fixes and improvements
- Bump Ubuntu 18.04 to 22.04 in CI test stage by @fflaten in #2252
- Bump macOS 10.15 to 12 in CI test stage by @fflaten in #2253
- Reorg Add-ShouldOperator P-tests to avoid 32 operator limit by @fflaten in #2248
- Update CI build image and PesterTests to .NET 6 by @fflaten in #2249
- Cache nugets in CI by @nohwnd in #2204
- Use latest C# language version by @nohwnd in #2250
- Cleanup remaining testcase param-blocks in tests by @fflaten in #2226
- Use Start plugin-step for TestDrive and TestRegistry PSDrive cleanup by @fflaten in #2237
- Fix support for PowerShell 6.0.4 by @fflaten in #2215
- Sign format files by @nohwnd in #2212
- Replace IsOriginalValue() with IsModified and fix merging and casting of default option values by @fflaten in #2201
- Start interactive execution from BeforeDiscovery by @fflaten in #2217
- Add GitHub Action to run PSScriptAnalyzer on PR and commit by @fflaten in #2221
- Replace alias and positional parameter usage in Coverage.ps1 by @fflaten in #2225
- Add -NoBuild for P-tests by @fflaten in #2200
- Update issue templates to forms syntax by @fflaten in #2176
- Update issue form templates by @fflaten in #2180
- Exclude docs and support files from triggering CI by @fflaten in #2184
- Minor improvements to build script by @fflaten in #2183
- Remove v4 param-blocks from HaveParameter tests by @fflaten in #2224
New Contributors
- @irishismyname made their first contribution in #2192
- @dtewinkel made their first contribution in #2247
Full Changelog: 5.3.3...5.4.0
5.4.0-rc1
In this release there are many fixes and improvements thanks @fflaten to providing most of them!
ANSI colors for output
Output is now printed with colors in AzureDevOps:
To achieve that, Pester detects if the host supports ANSI codes and uses them to output the string. You can control this by this new option:
[PesterConfiguration]::Default.Output.RenderMode
Default Description Value
------- ----------- -----
Auto The mode used to render console output, options are Auto, Ansi, ConsoleColor and Plaintext. Auto
And optionally switch back to classical ConsoleColor, or a new PlainText mode that outputs just text without any embedded formatting.
Check Multiple aliases for Should -HaveParameter
Should -HaveParameter
can now ensure that there are multiple aliases set for a parameter.
function f {
param( [Alias('UserName')] $Name )
$Name
}
Get-Command f | Should -HaveParameter Name -Alias 'n', 'UserName'
InvalidResult:
Line |
1 | Get-Command f | Should -HaveParameter Name -Alias 'n', 'UserName'
| Expected command f to have a parameter Name, with aliases 'n' and 'UserName',
| but it didn't have an alias 'n'.
- Add support for multiple aliases (-Alias) to Should -HaveParameter by @dtewinkel in #2247
Always return to the original path
Pester captures the current path in which Invoke-Pester
is invoked, and returns to this path after the execution of the test, even if the tests change it:
PS C:\projects\myModule> Invoke-Pester -Container (
New-PesterContainer -ScriptBlock {
Describe "d" {
It "i" {
Set-Location C:\Windows
}
}
})
This will return back to C:\projects\myModule
after your tests finish running.
Mocking in Manifest Modules
Mock, Should -Invoke and InModuleScope are now allowed for manifest modules.
Additional changes and improvements
-
Add Should-example for exception-assertion by @fflaten in #2171
-
Fix mocks with enum-parameters and ValidateRange by @fflaten in #2191
-
Don't run Get-CimInstance on Nanoserver by @irishismyname in #2192
-
Exit invoked testfile after interactive execution by @fflaten in #2218
-
Fix hang in New-TestRegistry when access is denied by @fflaten in #2236
-
Add support for assigning lists to StringArrayOption by @fflaten in #2232
-
Throw in Add-ShouldOperator when max number of operators is reached by @fflaten in #2231
-
Validate Should -Invoke is invoked in specified -Scope blocktype by @fflaten in #2230
-
Add -Because to Should -Invoke and -InvokeVerifiable by @fflaten in #2229
-
Fix NRE when assigning null to arrayoption in hashtable by @fflaten in #2219
-
Fix module installation in PowerShell 3 and 4 by @fflaten in #2214
-
Add help for dynamic operator parameters by @fflaten in #2170
-
Support int and double values when merging decimaloption by @fflaten in #2186
-
Update ExpandedPath before executing tests and blocks by @fflaten in #2254
Internal fixes and improvements
- Bump Ubuntu 18.04 to 22.04 in CI test stage by @fflaten in #2252
- Bump macOS 10.15 to 12 in CI test stage by @fflaten in #2253
- Reorg Add-ShouldOperator P-tests to avoid 32 operator limit by @fflaten in #2248
- Update CI build image and PesterTests to .NET 6 by @fflaten in #2249
- Cache nugets in CI by @nohwnd in #2204
- Use latest C# language version by @nohwnd in #2250
- Cleanup remaining testcase param-blocks in tests by @fflaten in #2226
- Use Start plugin-step for TestDrive and TestRegistry PSDrive cleanup by @fflaten in #2237
- Fix support for PowerShell 6.0.4 by @fflaten in #2215
- Sign format files by @nohwnd in #2212
- Replace IsOriginalValue() with IsModified and fix merging and casting of default option values by @fflaten in #2201
- Start interactive execution from BeforeDiscovery by @fflaten in #2217
- Add GitHub Action to run PSScriptAnalyzer on PR and commit by @fflaten in #2221
- Replace alias and positional parameter usage in Coverage.ps1 by @fflaten in #2225
- Add -NoBuild for P-tests by @fflaten in #2200
- Update issue templates to forms syntax by @fflaten in #2176
- Update issue form templates by @fflaten in #2180
- Exclude docs and support files from triggering CI by @fflaten in #2184
- Minor improvements to build script by @fflaten in #2183
- Remove v4 param-blocks from HaveParameter tests by @fflaten in #2224
New Contributors
- @irishismyname made their first contribution in #2192
- @dtewinkel made their first contribution in #2247
Full Changelog: 5.3.3...5.4.0-rc1