Forum Discussion

douglasdb1's avatar
douglasdb1
Copper Contributor
Sep 29, 2023

Sometimes Pull Request don't get the Azure Pipeline coverage result

We have a coverage job in a Node JS with Jest project configured in or pipeline:

 

 

 

And the job run and passed successfully:

 

 

 

But the PR still with awaiting:

 


Occasionally when we dispatch a re-queue once, the coverage works, but something we need to re-queue two or three times to work.

1 Reply

  • Please try to fix by the following:

     

    1. Ensure Jest outputs Cobertura format: In jest.config.js:

    coverageReporters: ['text', 'clover', 'cobertura']

    This generates cobertura-coverage.xml which Azure understands.

     

    2. Update your pipeline YAML:

    - task: PublishCodeCoverageResults@1
      inputs:
        codeCoverageTool: Cobertura
        summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml'
      condition: succeededOrFailed()

     

    3. Add a delay or dependency between test and publish steps to ensure coverage files are ready.

    4. Use PublishTestResults@2 for test output (e.g. junit.xml) to improve PR feedback:

    - task: PublishTestResults@2
      inputs:
        testResultsFiles: '**/junit.xml'
      condition: succeededOrFailed()

     

    5. Double-check PR triggers: Make sure your pipeline is configured to run on PRs and that the coverage task is part of that trigger.

Resources