Skip to content
Latchkey

Azure Pipelines PublishTestResults - No Files Matching the Pattern

The PublishTestResults@2 task scanned for result files (JUnit, NUnit, VSTest, etc.) and found none. The test runner wrote the report to a different path, used a different format, or did not produce one at all.

What this error means

The task warns or fails that no test result files matched the pattern, and the run shows no published test tab. The tests may have passed, but their results were never collected.

azure-pipelines
##[warning]No test result files matching **/TEST-*.xml were found.
##[error]No test results found to publish.

Common causes

Glob does not match the real output path

The testResultsFiles pattern (or searchFolder) points at a directory or filename the runner did not write to. The report exists elsewhere, or with a different extension.

Runner did not emit the chosen format

The task testRunner (JUnit/NUnit/VSTest) must match what the test command produced. A mismatch - or a missing reporter flag - means no parseable file exists.

How to fix it

Point the task at the real report path and format

Set testRunner, searchFolder, and testResultsFiles to match what the runner wrote.

azure-pipelines.yml
steps:
  - script: npm test -- --reporters=jest-junit
    env:
      JEST_JUNIT_OUTPUT_DIR: \$(System.DefaultWorkingDirectory)/test-results
  - task: PublishTestResults@2
    inputs:
      testRunner: JUnit
      searchFolder: '\$(System.DefaultWorkingDirectory)/test-results'
      testResultsFiles: '**/*.xml'

Confirm a report was produced

  1. Add a temporary ls -R to see where the test command wrote its report.
  2. Ensure the test command is configured to emit the format testRunner expects.
  3. Set failTaskOnFailedTests deliberately so publishing and gating are separate concerns.

How to prevent it

  • Match the publish glob to the runner's actual output directory.
  • Keep testRunner aligned with the report format produced.
  • Verify a report file exists before relying on the publish step.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →