Open
Description
Checklist
- Issue has a meaningful title
- I have searched the existing issues. See all issues
- I have tested using the latest version of Pester. See Installation and update guide.
What is the issue?
Providing a invalid encoding to CodeCoverage.OutputEncoding
throws an exception at the end of Invoke-Pester
breaking Run.PassThru
etc.
Expected Behavior
Properly typed configuration option or early validation in Invoke-Pester
to avoid breaking the run at the end.
Tests completed in 5.32s
Tests Passed: 437, Failed: 0, Skipped: 0, Inconclusive: 0, NotRun: 0
Processing code coverage result.
System.Management.Automation.RuntimeException: Invoking step End failed:
Result 1 - Error 1:Out-File: /workspaces/Pester/src/functions/Coverage.Plugin.ps1:194:88
Line |
194 | … h -Encoding $PesterPreference.CodeCoverage.OutputEncoding.Value -Forc …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot process argument transformation on parameter 'Encoding'. 'utf-15' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider
| method. (Parameter 'name')
at <ScriptBlock>, /workspaces/Pester/src/functions/Coverage.Plugin.ps1: line 194
at Invoke-PluginStep, /workspaces/Pester/src/Pester.Runtime.ps1: line 1275
at Invoke-Pester<End>, /workspaces/Pester/src/Main.ps1: line 853
at <ScriptBlock>, <No file>: line 12
at Assert-Success, /workspaces/Pester/src/Pester.Runtime.ps1: line 1332
at Invoke-PluginStep, /workspaces/Pester/src/Pester.Runtime.ps1: line 1294
at Invoke-Pester<End>, /workspaces/Pester/src/Main.ps1: line 853
at <ScriptBlock>, <No file>: line 12
Steps To Reproduce
# Executed in pester-repo
$c = New-PesterConfiguration
$c.Run.Path = './tst/functions/assertions'
$c.Run.ExcludePath = '*/demo/*', '*/examples/*', '*/testProjects/*', '*/Pester.Tests.ps1'
$c.Output.Verbosity = 'Detailed'
$c.CodeCoverage.Enabled = $true
$c.CodeCoverage.Path = './src/functions'
$c.CodeCoverage.UseBreakpoints = $false
$c.CodeCoverage.OutputFormat = 'JaCoCo'
$c.CodeCoverage.OutputEncoding = 'utf-15'
Invoke-Pester -Configuration $c
Describe your environment
Pester version : 5.6.0-beta1 /workspaces/Pester/bin/Pester.psm1
PowerShell version : 7.4.1
OS version : Unix 5.15.133.1
Possible Solution?
No response