Skip to content

Conversation

@nwalters512
Copy link
Contributor

@nwalters512 nwalters512 commented May 22, 2025

Description

This PR adds support for an onWritePath option for the GitHub Actions reporter. This can be used to customize the path that's written in GitHub's annotation command format. This names was taken from vitest-sonar-reporter as suggested by this comment: #8008 (comment).

This is useful for situations where tests might be run such that their paths don't match the paths that GitHub sees. For instance, if the tests are being run in a container, the paths might start with /app/, which GitHub can't map to a specific file in order to attach the annotation.

Closes #8008.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

@nwalters512
Copy link
Contributor Author

Sorry, I hit Cmd-Enter before I was done updating the PR description. Working on that now!

@netlify
Copy link

netlify bot commented May 22, 2025

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit ea956ad
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/682f6d504a4bd70008e8d03c
😎 Deploy Preview https://deploy-preview-8015--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@nwalters512 nwalters512 force-pushed the github-actions-reporter-on-write-path branch from 4172158 to 04db6fd Compare May 22, 2025 18:29
@nwalters512 nwalters512 force-pushed the github-actions-reporter-on-write-path branch from 04db6fd to ea956ad Compare May 22, 2025 18:30
@AriPerkkio AriPerkkio changed the title feat(vitest): Support onWritePath option in GithubActionsReporter feat(reporter): add onWritePath option to github-actions May 23, 2025
@AriPerkkio AriPerkkio force-pushed the github-actions-reporter-on-write-path branch from 5ab4e51 to 188cf18 Compare May 25, 2025 08:48
Copy link
Member

@AriPerkkio AriPerkkio left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for the PR @nwalters512! 💯

@sheremet-va sheremet-va merged commit abd3bb7 into vitest-dev:main May 26, 2025
12 of 13 checks passed
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.

Flexibility in GithubActionsReporter

3 participants