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 reporter options #5042

Closed
4 tasks done
hi-ogawa opened this issue Jan 25, 2024 · 2 comments · Fixed by #5111
Closed
4 tasks done

support reporter options #5042

hi-ogawa opened this issue Jan 25, 2024 · 2 comments · Fixed by #5111
Labels
enhancement New feature or request p2-nice-to-have Not breaking anything but nice to have (priority) pr welcome

Comments

@hi-ogawa
Copy link
Contributor

Clear and concise description of the problem

Spinned off from #5007 (comment)

To allow customizing reporter in a general manner (and also as Jest compatibility), Vitest should support reporter options.

Suggested solution

I think it's possible to support the same thing as Jest:

Currently Vitest doesn't assume anything about constructor arguments, so probably introducing this feature is not a breaking change:

else if (referenceOrInstance in ReportersMap) {
const BuiltinReporter = ReportersMap[referenceOrInstance as BuiltinReporters]
return new BuiltinReporter()
}
else {
const CustomReporter = await loadCustomReporterModule(referenceOrInstance, runner)
return new CustomReporter()
}

Alternative

Currently minor customization can be provided by environment variable

Or by using custom field in test config:

Additional context

No response

Validations

@hi-ogawa hi-ogawa added the enhancement New feature or request label Jan 25, 2024
@hi-ogawa hi-ogawa added pr welcome p2-nice-to-have Not breaking anything but nice to have (priority) and removed pr welcome labels Jan 25, 2024
@AriPerkkio
Copy link
Member

@hi-ogawa did you start any work on this? I think I could work on this next. I have got some feature requests related to this on my custom reporter:

@hi-ogawa
Copy link
Contributor Author

hi-ogawa commented Feb 3, 2024

@AriPerkkio No, I haven't made any code yet. Fell free to take it. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request p2-nice-to-have Not breaking anything but nice to have (priority) pr welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants