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.OutputFormat
Looking 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.OutputFormat
To
CodeCoverageOutputFileFormat = $PSBPreference.Test.CodeCoverage.OutputFileFormat
Alternative (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
Executing the Test task fails when processing the Code Coverage results with error:
Expected Behavior
Expect to get the Code Coverage results in line with:
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 Pesterdeclaration when setting theCodeCoverageOutputFileFormatvalue:Looking at the
build.properties.ps1file, that particular Ordered dictionary key is set to:Possible Solution
It's a simple Typo fix - update the psakeFile.ps1
Task Pesterentry from:To
Alternative (and temporary) workaround - update the invoking psakeFile.ps1 properties section to call the override of the mis-named property:
This has the desired effect.
Steps to Reproduce (for bugs)
properties { $PSBPreference.Test.ScriptAnalysisEnabled = $true $PSBPreference.Test.CodeCoverage.Enabled = $true }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