Skip to content

Commit

Permalink
feat: support config junit reporter className with env (#3808)
Browse files Browse the repository at this point in the history
  • Loading branch information
InfiniteXyy committed Jul 28, 2023
1 parent f3bd910 commit e8bc46b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/config/index.md
Expand Up @@ -486,7 +486,7 @@ Custom reporters for output. Reporters can be [a Reporter instance](https://gith
- `'basic'` - give a reporter like default reporter in ci
- `'verbose'` - keep the full task tree visible
- `'dot'` - show each task as a single dot
- `'junit'` - JUnit XML reporter (you can configure `testsuites` tag name with `VITEST_JUNIT_SUITE_NAME` environmental variable)
- `'junit'` - JUnit XML reporter (you can configure `testsuites` tag name with `VITEST_JUNIT_SUITE_NAME` environmental variable, and `classname` tag property with `VITEST_JUNIT_CLASSNAME`)
- `'json'` - give a simple JSON summary
- `'html'` - outputs HTML report based on [`@vitest/ui`](/guide/ui)
- `'hanging-process'` - displays a list of hanging processes, if Vitest cannot exit process safely. This might be a heavy operation, enable it only if Vitest consistently cannot exit process
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/node/reporters/junit.ts
Expand Up @@ -168,7 +168,7 @@ export class JUnitReporter implements Reporter {
async writeTasks(tasks: Task[], filename: string): Promise<void> {
for (const task of tasks) {
await this.writeElement('testcase', {
classname: filename,
classname: process.env.VITEST_JUNIT_CLASSNAME ?? filename,
name: task.name,
time: getDuration(task),
}, async () => {
Expand Down

0 comments on commit e8bc46b

Please sign in to comment.