Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File is not found during code coverage report generation #22

Open
emmanuelbenitez opened this issue May 26, 2020 · 5 comments
Open

File is not found during code coverage report generation #22

emmanuelbenitez opened this issue May 26, 2020 · 5 comments
Assignees

Comments

@emmanuelbenitez
Copy link

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
@ChrisLGardner
Copy link
Collaborator

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.

@emmanuelbenitez
Copy link
Author

Hi,

Do you plan to check this issue?

Thanks in advance.

@ChrisLGardner
Copy link
Collaborator

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 ChrisLGardner self-assigned this Jun 24, 2020
@Adunaphel
Copy link

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

@petertheautomator
Copy link

Any update on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants