Skip to content

feat(reporters): add fileTemplate option to JUnit reporter#10362

Closed
mixelburg wants to merge 1 commit into
vitest-dev:mainfrom
mixelburg:fix/junit-file-prefix
Closed

feat(reporters): add fileTemplate option to JUnit reporter#10362
mixelburg wants to merge 1 commit into
vitest-dev:mainfrom
mixelburg:fix/junit-file-prefix

Conversation

@mixelburg

Copy link
Copy Markdown

Fixes #10341

Adds a fileTemplate option to the JUnit reporter, analogous to the existing classnameTemplate. This lets users control the value of the file attribute on <testcase> elements and the name attribute on <testsuite> elements — useful in pnpm monorepos where the default relative path may not include enough prefix for test analytics or CODEOWNERS matching.

Usage

// string template with {filename} and {filepath} placeholders
reporters: [['junit', { fileTemplate: 'packages/{filename}/src', addFileAttribute: true }]]

// function template
reporters: [['junit', { fileTemplate: ({ filepath }) => filepath.replace(/.*fixtures\//, ''), addFileAttribute: true }]]

Unlike classnameTemplate, which only affects the classname attribute, fileTemplate affects both file and testsuite name while leaving classname unchanged (unless classnameTemplate is also set).

@netlify

netlify Bot commented May 15, 2026

Copy link
Copy Markdown

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 6989c62
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6a079a03c794410009720ccc
😎 Deploy Preview https://deploy-preview-10362--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@sheremet-va

sheremet-va commented May 17, 2026

Copy link
Copy Markdown
Member

Seems like your branch is outdated, clanker

733998b2-6b5b-442c-864f-eda83827cdd3_text

@sheremet-va sheremet-va added the maybe automated User is likely an AI agent, or the content was generated by an AI assistant without user control label May 17, 2026
@github-actions

Copy link
Copy Markdown

Hello @mixelburg. Your PR has been labeled maybe automated because it appears to have been fully generated by AI with no human involvement. It will be closed automatically in 3 days unless a real person responds.

If you're a real person behind this contribution, please:

  • Confirm you've personally reviewed and stand behind its content
  • Make sure it follows our contribution guidelines and uses the correct GitHub template
  • Disclose any AI tools you used (e.g. Claude, Copilot, Codex)

If you believe this was flagged by mistake, leave a comment.

These measures help us reduce maintenance burden and keep the team's work efficient. See our AI contributions policy for more context.

@TylerJang27

Copy link
Copy Markdown

@AriPerkkio I think this would work for me. Can you look into getting this landed?

@sheremet-va

sheremet-va commented May 19, 2026

Copy link
Copy Markdown
Member

Closing this as this AI clanker account has been known to be inactive in comments and ignores any reviews. Their account is also blocked

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

Labels

maybe automated User is likely an AI agent, or the content was generated by an AI assistant without user control

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support fileTemplate/filePrefix alongside junit classnameTemplate

3 participants