fix(reporter): task.meta should be available in custom reporter's errors#8115
Merged
sheremet-va merged 1 commit intovitest-dev:mainfrom Jun 11, 2025
Conversation
AriPerkkio
commented
Jun 6, 2025
Comment on lines
+244
to
+255
| class Custom extends DefaultReporter { | ||
| getFullName(test: RunnerTask, separator?: string): string { | ||
| return `${separator}{ name: ${test.name}, meta: ${test.meta.custom} } (Custom getFullName here)` | ||
| } | ||
| } | ||
|
|
||
| const { stderr } = await runVitest({ | ||
| root: 'fixtures/metadata', | ||
| reporters: new Custom(), | ||
| }) | ||
|
|
||
| expect(stderr).toMatch('FAIL > { name: fails, meta: Failing test added this } (Custom getFullName here') |
Member
Author
sheremet-va
reviewed
Jun 9, 2025
| return getTestName(test, separator) | ||
| } | ||
|
|
||
| protected getFullName(test: Task, separator?: string): string { |
Member
There was a problem hiding this comment.
One thing I don't like here is the use of Task since it's an experimental API, but to have the reported entity, we would have to rewrite the reporter which is probably outside of the scope of this PR
Member
Author
There was a problem hiding this comment.
Yeah, this is inline with protected getTestName(test: Task, separator?: string) above.
Member
There was a problem hiding this comment.
Yeah, but the previous one was there before the new API
sheremet-va
approved these changes
Jun 11, 2025
This was referenced Aug 12, 2025
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.