Skip to content
Latchkey

How to Show Test Results in the UI in Bitbucket Pipelines

Bitbucket auto-detects JUnit XML written under test-results/ and renders a Tests tab on the pipeline.

There is no publish task - just emit JUnit XML into the test-results/ glob (or /test-results/**) and Bitbucket parses it automatically after the step.

Emit JUnit XML for auto-detection

Writing the report under test-results/ is all Bitbucket needs to render the Tests view.

bitbucket-pipelines.yml
image: node:20

pipelines:
  default:
    - step:
        name: Test
        script:
          - npm ci
          - npm test -- --reporters=default --reporters=jest-junit
        after-script:
          - echo "tests done"
# jest-junit configured to output to ./test-results/junit.xml

Gotchas

  • Bitbucket auto-detects reports under test-results/**/*.xml - there is no explicit publish step to add.
  • The report must be JUnit-format XML; other formats are not parsed into the Tests tab.
  • Test results are collected even if the step fails, so failing tests still appear - keep the reporter writing on failure.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →