Skip to content
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

Support customized junit report format #3691

Closed
4 tasks done
InfiniteXyy opened this issue Jun 28, 2023 · 2 comments
Closed
4 tasks done

Support customized junit report format #3691

InfiniteXyy opened this issue Jun 28, 2023 · 2 comments
Labels
enhancement New feature or request pr welcome

Comments

@InfiniteXyy
Copy link
Contributor

InfiniteXyy commented Jun 28, 2023

Clear and concise description of the problem

Currently, when using reporters: ["junit"], only testsuites is configurable, could we also make classNameTemplate andtitleTemplate comfigurable, so that I can use custom seperator between classname and title, or remove classname totally.

await this.writeElement('testcase', {
classname: filename,
name: task.name,

Suggested solution

In jest-junit there are some configurable env values, like JEST_JUNIT_CLASSNAME

and we also have VITEST_JUNIT_SUITE_NAME in vitest, we could add more env variables to help config the junit output

Alternative

No response

Additional context

The configratuion for jest-junit documentation:
https://github.com/jest-community/jest-junit#configuration

Validations

@InfiniteXyy InfiniteXyy changed the title Support customized junit format Support customized junit report format Jun 28, 2023
@sheremet-va sheremet-va added enhancement New feature or request pr welcome labels Jun 28, 2023
@AriPerkkio
Copy link
Member

Instead of supporting environment variables we should open an API for providing reporter options. The coverage reporters already support this kind of API:

vitest/docs/config/index.md

Lines 786 to 800 in 726a57e

The reporter has three different types:
- A single reporter: `{ reporter: 'html' }`
- Multiple reporters without options: `{ reporter: ['html', 'json'] }`
- A single or multiple reporters with reporter options:
<!-- eslint-skip -->
```ts
{
reporter: [
['lcov', { 'projectRoot': './src' }],
['json', { 'file': 'coverage.json' }],
['text']
]
}
```

This is something that 3rd party custom reporters could also utilize.

@InfiniteXyy
Copy link
Contributor Author

InfiniteXyy commented Jul 25, 2023

I created a simple PR for my own usecase (to remove the filepath in className), would it be OK for the merge?
#3808

@github-actions github-actions bot locked and limited conversation to collaborators Aug 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request pr welcome
Projects
None yet
Development

No branches or pull requests

3 participants