-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(reporter): add support for function type to classname option in the junit reporter #6839
base: main
Are you sure you want to change the base?
Conversation
…on in the junit reporter
Hey, thanks for the PR. Can you explain your specific use case? While exposing As an alternative, would it work for you if we support Btw, what we support right now for |
We ended up having test cases with duplicated class names in our project and our CI/CD reporting UI couldn't handle duplicates. For that reason we need a more flexible way to generate classnames in order to make them more unique. Exposing Task definitly felt a bit wrong. I just looked at jest's classNameTemplate and definitly feels cleaner. I'll make the change to mimic that behavior. Current classname option feels useless indeed, can't see a use for that. |
@jpleclerc what properties of |
@AriPerkkio In our case the file name and path is enough. I think the jest-junit project got it right. I'm thinking of supporting at least the following:
|
- classnameTemplate can take a function or a string - the string can be parameterized Change-Id: I6a79ed8f89e23e518c8d18f6fe49a210edaa247a
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
… classnameTemplate Change-Id: I03a3d47d26aa36ca5c14cf790a19629d151b7c61
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
I think we can deprecate (and remove later) classname
as it's useless and easy to move to classnameTemplate
as a constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! We should also update documentation. Maybe something about classnameTemplate
after this section:
vitest/docs/guide/reporters.md
Lines 252 to 262 in 5d4b382
The outputted XML contains nested `testsuites` and `testcase` tags. You can use the reporter options to configure these attributes: | |
```ts | |
export default defineConfig({ | |
test: { | |
reporters: [ | |
['junit', { suiteName: 'custom suite name', classname: 'custom-classname' }] | |
] | |
}, | |
}) | |
``` |
Change-Id: I1caa6e359998071ced9839ad27d121d25e8b8d99
… fixed typo. Change-Id: Ie77e0955011fa42d2a8ef42c074327589d780739
Change-Id: I6d4e936a6cabaacf31a82036acf22f9af401bdb0
Description
This PR adds support for a function for the classname option for the junit reporter.
It is currently possible to specify a static string as the classname of the junit reporter but it is not flexible enough in some case.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.