-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
proposal: Fields for easier custom reporter development #8600
Comments
I think you're looking for #7900. Please leave a comment on your use case there :) (closing this one then, hope you don't mind) |
That looks quite similar, I think it probably touches on some of the pain points. There's is a lot of code related to dealing with splitting up and dealing with the error messages, despite them being formed from something far more usable within Jest itself. I suppose it might be worth trying to lump this into that, maybe this is a requirement of making #7900 work. In the meantime, I suppose that doesn't leave me with many options other than to try use something else sadly. |
There's also #3160, but it's kinda stale for a while now, as we encountered a bunch of gotchas while prototyping. That saying, it's not a trivial thing to solve in Jest unfortunately. |
You should ideally get underlying assertion error (#7594, PR welcome), if that's all you wanna format. That won't help for other errors though. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Quite a simple proposal. I think there should be more fields to use in custom reporters. At present there's not much useful / usable information in a TestResult. Status, titles, duration, and number of passing assertions are all great, but it'd also be really useful to see more about what went wrong when something went wrong.
I can get a little bit closer to what I'm thinking if I disable colours, but I don't think I should have to disable colours to get a plain string of the error from custom reporter API.
Here's part of a snippet of some of this output for example:
But it seems like it should be possible to expose the components of an error to build up strings with custom formatting; for example, to build up a rich block for a Slack notification for the error.
As above, it'd be useful simply to build more expressive and useful custom reporters. Slack is a good example, as it supports richer content than just text. So having the pieces of an error to build and split into sections can make quite a lot of difference to how easy it is to parse one of those error messages.
If the assertions are controlled as part of Jest, then surely they can be made to expose the error information in an easy to consume way (e.g. "expected x, received y" information, so on).
The text was updated successfully, but these errors were encountered: