Closed
Description
Where are you running it?
You can run the extensions in the cloud or on-premise
- Azure DevOps Service (VSTS)
Version of Extension/Task
10.1.17
Expected behaviour and actual behaviour
I expected all .ps1 files to be used for the codecoverage.xml file but only the ones in the ./tests folder show results.
Steps to reproduce the problem
Set -CodeCoverageFolder .
or to the base folder
├───.vscode
├───docs
│ └───images
├───ModuleFolder
│ ├───private
│ └───public
├───TestResults
└───Tests
azure-pipelines.yml file:
- task: Pester@10
displayName: Pester Test Runner
inputs:
TestFolder: './tests'
resultsFile: '$(Common.TestResultsDirectory)/Test-Pester.XML'
CodeCoverageOutputFile: '$(Common.TestResultsDirectory)/CC-Pester.XML'
usePSCore: ${{ parameters.pscore }}
CodeCoverageFolder: '$(Build.Repository.LocalPath)/'
PesterVersion: OtherVersion
preferredPesterVersion: 5.0.2
additionalModulePath: '$(System.DefaultWorkingDirectory)/**/*.psm1'
Findings during testing
$pesterConfig is correct and $pesterconfig.CodeCoverage.Path returns all the files.
$PesterConfig['CodeCoverage'] = $CodeCoverage
if (-not([String]::IsNullOrWhiteSpace($ScriptBlock))) {
$ScriptBlockObject = [ScriptBlock]::Create($ScriptBlock)
$ScriptBlockObject.Invoke()
}
$result = Invoke-Pester -Configuration ([PesterConfiguration]$PesterConfig)
However, when the configuration object is created, ([PesterConfiguration]$PesterConfig).CodeCoverage.Path.Value is an empty array.