-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)pr welcome
Description
Describe the bug
Currently, benchmark.reporters has the type Arrayable<"default" | "verbose" | Reporter>, meaning the only strings it can accept without type errors are those of the built-in bench reporters.
This goes directly against its documentation ("... one or more built-in report names, reporter instances, and/or paths to custom reporters"1), as well as Vitest's runtime behavior of using the reporter as normal.
vitest/packages/vitest/src/node/types/benchmark.ts
Lines 27 to 33 in 4d7938a
| /** | |
| * Custom reporter for output. Can contain one or more built-in report names, reporter instances, | |
| * and/or paths to custom reporters | |
| * | |
| * @default ['default'] | |
| */ | |
| reporters?: Arrayable<BenchmarkBuiltinReporters | Reporter> |
A solution would be adding string & {} to the type signature; this would allow arbitrary strings while preserving IDE autocomplete for the default types.
Reproduction
System Info
N/A; occurs on latest version of vitest.Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Footnotes
-
Bolded for emphasis ↩
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)pr welcome