Skip to content

Add file property to JUnit report entry#40231

Open
dfrankland wants to merge 1 commit intomicrosoft:mainfrom
dfrankland:patch-1
Open

Add file property to JUnit report entry#40231
dfrankland wants to merge 1 commit intomicrosoft:mainfrom
dfrankland:patch-1

Conversation

@dfrankland
Copy link
Copy Markdown

Many tools look for the file attribute as a way of understanding where a test is located and attributing some statistics or codeowners.

Many tools look for the `file` attribute as a way of understanding where a test is located and attributing some statistics or codeowners.

Signed-off-by: Dylan Frankland <dfrankland@users.noreply.github.com>
@yury-s
Copy link
Copy Markdown
Member

yury-s commented Apr 16, 2026

Please start with filing a bug and describing the problem. Also the change will need a test if we want it to be landed.

@yury-s
Copy link
Copy Markdown
Member

yury-s commented Apr 16, 2026

A couple of concerns on the semantics of file if this lands:

  1. Base-dir convention. suiteName here is path.relative(config.rootDir, file) (set in testLoader.ts). Other ecosystems disagree on what file should be anchored to — pytest uses the invocation dir, several Jest/Vitest reporters use CWD, some emit absolute paths. Tools consuming JUnit in CI (GitHub Actions annotators, Codecov path-fixing, CODEOWNERS mappers, test-insight products like Trunk/Datadog/BuildPulse) typically resolve file against the repo root or CWD, not Playwright's rootDir. In monorepos where the config lives in a subfolder this silently produces paths that don't match the git tree and annotations get dropped or misattributed.

  2. Path separators. On Windows, path.relative returns \-separated paths; most downstream tools match against forward-slash git paths.

Today classname already carries the same value, so nothing behaviorally changes — but once file is the attribute consumers prefer, the rootDir-relative + native-separator convention becomes load-bearing. Worth either normalizing to forward slashes + anchoring to something git-root-ish, or documenting the contract explicitly.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants