fix(@wdio/allure-reporter): add host label to test results by MannXo · Pull Request #16145 · webdriverio/webdriverio · GitHub
Skip to content

fix(@wdio/allure-reporter): add host label to test results - #16145

Open
MannXo wants to merge 1 commit into
webdriverio:mainfrom
MannXo:fix/16142-allure-host-label
Open

MannXo wants to merge 1 commit into
webdriverio:mainfrom
MannXo:fix/16142-allure-host-label

Conversation

@MannXo

@MannXo MannXo commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

Fixes #16142.

Allure's timeline groups results by the host and thread labels. @wdio/allure-reporter set thread from the cid but never set host, so the timeline rendered empty.

The three label sites (_startCucumberTest, _startTest, _emitBaseLabels) now add { name: 'host', value: os.hostname() }. If ALLURE_LABEL_host is set, the env label is used on its own and no default is added, so the current workaround keeps working and a result never carries two host labels.

How you tested

  • Unit tests for the touched package(s)

  • Type definition tests (if the public API / command types changed)

  • Smoke or e2e (only if the testrunner, launcher, or a real browser path changed)

  • pnpm run test:package wdio-allure-reporter equivalent (vitest --run packages/wdio-allure-reporter): 198 passed. The host assertions in suite.test.ts and cucumber.suite.test.ts fail with the src change reverted. A new test checks ALLURE_LABEL_host still wins.

  • pnpm run test:unit:run: 529 files, 7901 passed, 42 skipped.

  • test:oxlint, test:ejslint, test:depcheck, test:browser-lib, test:typings all pass.

  • Smoke proof: pnpm run test:smoke cucumberGroupedSpecsRandomOrderHistory with a temporary assertion (not committed) that every *-result.json has exactly one host label equal to os.hostname(). All 12 result files pass with the fix. Without it the first result has [] and the suite fails.

Types of changes

  • Polish (an improvement for an existing feature)
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (improvements to the project's docs)
  • Specification changes (updates to WebDriver command specifications)
  • Internal updates (everything related to internal scripts, governance documentation and CI files)

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Backport Request

  • This change is solely for v10 and doesn't need to be back-ported
  • Back-ported PR at #XXXXX

The v9 reporter has the same three sites without a host label, so a port looks worthwhile. Happy to open it once this lands.

Further comments

The env-var check keeps an explicit ALLURE_LABEL_host authoritative rather than relying on how Allure picks between duplicate labels.

Reviewers: @webdriverio/project-committers

Allure's timeline groups results by host and thread. The reporter only
set the thread label, so the timeline rendered empty. Add a host label
from os.hostname() next to it, unless ALLURE_LABEL_host already sets one.

Fixes webdriverio#16142
@MannXo
MannXo requested a review from a team as a code owner October 19, 2026 11:39
@wdio-bot wdio-bot added the PR: Bug Fix 🐛 PRs that contain bug fixes label Oct 19, 2026
@pkg-pr-new

pkg-pr-new Bot commented Oct 19, 2026

Copy link
Copy Markdown

@greptile-apps

greptile-apps Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] Adds hostname label to test result metadata.

The PR appears safe to merge, with a non-blocking test-isolation issue.

Findings

  1. P2 Host settings break default tests ▶

Summary

Adds a default host label at the reporter’s three existing base-label sites.

  • Allure results include the machine host unless one is set.

Reviews (1) · Last reviewed commit: "fix(@wdio/allure-reporter): add host lab..." · Reviewed by Greptile

Comment on lines +188 to +189

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Host settings break default tests

If the shell already sets ALLURE_LABEL_host, the reporter correctly keeps that value, but these new assertions expect hostname() and fail. The new assertion in cucumber.suite.test.ts has the same problem. Clear ALLURE_LABEL_host before creating the reporter in both default-host setups, then restore it afterward. Keep the explicit override test separate.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Bug Fix 🐛 PRs that contain bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: @wdio/allure-reporter v10: missing host label causes empty Allure timeline view

2 participants