AzureDevOpsExtension icon indicating copy to clipboard operation
AzureDevOpsExtension copied to clipboard

File is not found during code coverage report generation

Open emmanuelbenitez opened this issue 5 years ago • 5 comments

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: image

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

emmanuelbenitez avatar May 26 '20 08:05 emmanuelbenitez

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.

ChrisLGardner avatar May 26 '20 08:05 ChrisLGardner

Hi,

Do you plan to check this issue?

Thanks in advance.

emmanuelbenitez avatar Jun 22 '20 11:06 emmanuelbenitez

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.

ChrisLGardner avatar Jun 24 '20 07:06 ChrisLGardner

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

Adunaphel avatar Jan 20 '22 13:01 Adunaphel

Any update on this issue?

petertheautomator avatar Mar 24 '22 10:03 petertheautomator