Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke-Pester breaks on invalid CodeCoverage.OutputEncoding format #2451

Open
3 tasks done
fflaten opened this issue May 13, 2024 · 0 comments
Open
3 tasks done

Invoke-Pester breaks on invalid CodeCoverage.OutputEncoding format #2451

fflaten opened this issue May 13, 2024 · 0 comments
Labels

Comments

@fflaten
Copy link
Collaborator

fflaten commented May 13, 2024

Checklist

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant