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
Checklist
What is the issue?
Providing a invalid encoding to
CodeCoverage.OutputEncoding
throws an exception at the end ofInvoke-Pester
breakingRun.PassThru
etc.Expected Behavior
Properly typed configuration option or early validation in
Invoke-Pester
to avoid breaking the run at the end.Steps To Reproduce
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