-
-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Executing the Test task fails when processing the Code Coverage results with error:
System.Management.Automation.RuntimeException: CodeCoverage.CoverageFormat must be 'JaCoCo' or 'CoverageGutters', but it was , please review your configuration.Expected Behavior
Expect to get the Code Coverage results in line with:
Code Coverage:
Type: [Instruction]: 0.00%
Type: [Line]: 0.00%
Type: [Method]: 100.00%
Type: [Class]: 100.00%Current Behavior
Looking at the code for the latest release of the module (version 0.6.1), there seems to be a typo in the Task Pester declaration when setting the CodeCoverageOutputFileFormat value:
CodeCoverageOutputFileFormat = $PSBPreference.Test.CodeCoverage.OutputFormatLooking at the build.properties.ps1 file, that particular Ordered dictionary key is set to:
# The code coverage output format to use
OutputFileFormat = 'JaCoCo'Possible Solution
It's a simple Typo fix - update the psakeFile.ps1 Task Pester entry from:
CodeCoverageOutputFileFormat = $PSBPreference.Test.CodeCoverage.OutputFormatTo
CodeCoverageOutputFileFormat = $PSBPreference.Test.CodeCoverage.OutputFileFormatAlternative (and temporary) workaround - update the invoking psakeFile.ps1 properties section to call the override of the mis-named property:
$PSBPreference.Test.CodeCoverage.OutputFormat = 'JaCoCo'This has the desired effect.
Steps to Reproduce (for bugs)
- In your invoking module's psakeFile.ps1 properties section, include:
properties {
$PSBPreference.Test.ScriptAnalysisEnabled = $true
$PSBPreference.Test.CodeCoverage.Enabled = $true
}- Run the Test Task
- Tests run, failure occurs on the Code Coverage step
Context
I'm still in the early stages of incorporating the scaffolding on offer by this module into our development workflow. This is clearly not a critical bug (there's a simple enough workaround), but it's also low hanging fruit for fixing (I can do a PR)
Your Environment
- Module version used: 0.6.1
- Operating System and PowerShell version: 7.2.3