Repository navigation
Conversation
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
[Medium impact] Adds hostname label to test result metadata. The PR appears safe to merge, with a non-blocking test-isolation issue. Findings
SummaryAdds a default
Reviews (1) · Last reviewed commit: "fix(@wdio/allure-reporter): add host lab..." · Reviewed by Greptile |
There was a problem hiding this comment.
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!

Proposed changes
Fixes #16142.
Allure's timeline groups results by the
hostandthreadlabels.@wdio/allure-reportersetthreadfrom the cid but never sethost, so the timeline rendered empty.The three label sites (
_startCucumberTest,_startTest,_emitBaseLabels) now add{ name: 'host', value: os.hostname() }. IfALLURE_LABEL_hostis 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-reporterequivalent (vitest --run packages/wdio-allure-reporter): 198 passed. The host assertions insuite.test.tsandcucumber.suite.test.tsfail with thesrcchange reverted. A new test checksALLURE_LABEL_hoststill wins.pnpm run test:unit:run: 529 files, 7901 passed, 42 skipped.test:oxlint,test:ejslint,test:depcheck,test:browser-lib,test:typingsall pass.Smoke proof:
pnpm run test:smoke cucumberGroupedSpecsRandomOrderHistorywith a temporary assertion (not committed) that every*-result.jsonhas exactly onehostlabel equal toos.hostname(). All 12 result files pass with the fix. Without it the first result has[]and the suite fails.Types of changes
Checklist
Backport Request
v10and doesn't need to be back-ported#XXXXXThe
v9reporter 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_hostauthoritative rather than relying on how Allure picks between duplicate labels.Reviewers: @webdriverio/project-committers