-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix(reporter): task.meta
should be available in custom reporter's errors
#8115
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
fix(reporter): task.meta
should be available in custom reporter's errors
#8115
Conversation
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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is exactly that 👍
@@ -249,6 +249,10 @@ export abstract class BaseReporter implements Reporter { | |||
return getTestName(test, separator) | |||
} | |||
|
|||
protected getFullName(test: Task, separator?: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is inline with protected getTestName(test: Task, separator?: string)
above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but the previous one was there before the new API
Description
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.