-
Notifications
You must be signed in to change notification settings - Fork 1.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
Enhancements to custom reporter #5437
Comments
This reporter was hacked together by me, based on a project I found offline and some work by Chris. It needs general polishing and better testing, and we also need to add some custom functionality. These are the polishing and testing things we need to improve:
Custom functionalityCustomizing how errors are displayedWe want to be able to show custom error details in some cases, in particular, when the error comes from a failed transaction that we run within EDR. Instead of this reporter knowing about it, we should provide a generic solution to customize the how the details of an error are displayed. I imagine something like checking if the error has a special property defined (e.g. |
I really liked this idea and even explored, at length, if we could piggy-back on Custom Inspection Functions on Objects because that would give us access to a wide array of nice, standard formatting for all sorts of error objects (AssertionError, for example, implements custom inspection). Unfortunately, I discovered that when the node test runner executes tests in process isolation mode (the default), unsurprisingly, we don't have access to class methods :( There is an experimental isolation flag in the node's HEAD, which allows turning off isolation, but I don't think that's something we should pursue. So, for custom error formatting, I'm afraid we might have to either put a pre-formatted message on the error object as a property before it is propagated out of a child test process or embed the knowledge on how to format specific errors in the custom reporter. In e94c4bf I did a crude exploration of how we could potentially recreate concrete error classes in the reporter (to be able to access custom formatters defined in them) while keeping the dependencies on the error providers optional. Still, I'm not sure how I feel about it yet. |
Does node serialize all the data that's present in the error? By that I mean, if we add custom fields with json-serializable values, do we get those? If we do, we can create some convention around it. |
Yes, that we can definitely do. We do have access to serializable values. That's exactly how |
In Hardhat v3 we expect the default experience will include the
./v-next/hardhat-node-test-reporter
as part of the install.This is a placeholder for improvements to the custom reporter.
PRs
Done
The general architecture of the project is a bit rough, I think it could use some documentation/explanations. Things about separation of the main generator with the UI are there, but maybe a bit messy.
In Review
In Progress
TODO
The text was updated successfully, but these errors were encountered: