File is not found during code coverage report generation
Where are you running it?
- Azure DevOps Service (VSTS)
Version of Extension/Task
Version: 10.0.3
Expected behaviour
When the task "PublishCodeCoverageResults" is used in a pipeline, the report contains the file and the user can see the line of file are covered or not
Actual behaviour
In the log, the following warning are logged:
2020-05-19T19:49:35: File 'X.psm1' does not exist (any more).
The report does not contains the file content:

Steps to reproduce the problem
The PowerShell Module contains nested module.
YAML Configuration
- task: Pester@9
displayName: "Test PowerShell Module with Pester"
inputs:
scriptFolder: '$(build.sourcesdirectory)'
resultsFile: "$(build.sourcesdirectory)/PowerShellModuleProject.Tests.XML"
CodeCoverageOutputFile: '$(build.sourcesdirectory)\coverage.powershell-module.xml'
CodeCoverageFolder: '$(build.sourcesdirectory)'
usePSCore: False
- task: PublishTestResults@2
displayName: "Publish Test Results"
inputs:
testResultsFormat: 'NUnit'
testResultsFiles: "$(build.sourcesdirectory)/PowerShellModuleProject.Tests.XML"
mergeTestResults: true
failTaskOnFailedTests: true
testRunTitle: 'PowerShell Module Tests'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'JaCoCo'
summaryFileLocation: '$(build.sourcesdirectory)\coverage.powershell-module.xml'
pathToSources: '$(build.sourcesdirectory)'
failIfCoverageEmpty: true
Thanks for reporting this. I think this might be an issue with how Pester generates the code coverage but I'll look into it further this week when I get a chance.
Hi,
Do you plan to check this issue?
Thanks in advance.
Hi
I'm hoping to have some time soon to fix a few things in this repo, I'll aim to include this if it's something I can fix.
I recently ran into this when upgrading from Pester 5.1.x to Pester 5.3.x. After a bit of investigating, it appears that the path of code files is expressed differently between these versions.
in Petser 5.1.x's xml output the formatting is as follows:
<sourcefile name="filename.ext">
In Pester 5.3 it is
<sourcefile name="relativedir/filename.ext">
The 5.1 format works, the 5.3 format breaks in the way described in this issue
Any update on this issue?