-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat: support reporting AggregateErrors #5018
Conversation
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.
Thanks for the contribution! 🙏
Some initial feedback
Plus one on this. I just ran into it. Is anyone working on this anymore? It looks like maybe the feedback was addressed? |
Somewhere between Node 16 and Node 20, Node's own APIs started throwing |
I addressed all the changes and sent an email to voxpelli to see if he could approve it. |
I'll try to get around to it soon, else eg. @JoshuaKGoldberg can chime in? |
Modified check for if an error is an instance of an AggregateError when recursively printing errors
I'm running out of time to review and merge this today, but this one together with these two are my main priority right now: |
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.
Good start! 🙌
I'd also like to hear from @voxpelli, but leaving some thoughts in the meantime too.
bin/mocha.js
Outdated
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.
Still the permissions change? Is there an automatic modification happening on save or something like that?
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.
It's possible. I'll look into it this week.
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.
Whoops, I'd meant to post this a bit back, sorry - but looks like there are failing tests?
} else if (test.err) { | ||
err = test.err; | ||
} else { | ||
// Handles when failures is a list of errors and not test objects. | ||
err = test; |
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.
[Style] ✨
} else if (test.err) { | |
err = test.err; | |
} else { | |
// Handles when failures is a list of errors and not test objects. | |
err = test; | |
} else if (test.err) { | |
// Handles when failures is a list of errors and not test objects. | |
err = test.err || test; |
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.
@CheadleCheadle there are tests failing, could you please take a look?
Note that I just pulled the latest changes in from main
(renamed from master
). They didn't fix the test failure.
👋 Ping @CheadleCheadle, is this still something you have energy & time for? |
@JoshuaKGoldberg I'm very interested in seeing this land. What's the best way for me to help, open PRs against this branch? Or open a brand-new PR with these same changes? |
@nwalters512 Brand new PR would be the way to go I would say, that references this one and the original issue in it’s description |
Yeah, this has been stale for a while. I think it's safe to close out. If you end up using code from this PR, please add a co-author attribution. Otherwise 🚀 free to make a new one! |
Requirements
Description of the Change
Addresses #4982
If an AggregateError is thrown, the base reporter will print out the AggregateError's errors. Before this change, only the Aggregate Error itself was printed. So, if the current error being printed is an Aggregate error the errors it contains will also be formatted and printed.
Alternate Designs
I could have completely restructured the Base.list method to only loop over the failures and call a helper function that would create the format(fmt), msg, and title and then print the error, but it was much simpler to just add a conditional check to see if the current error being printed was an AggregateError and if it contained multiple errors and just
Why should this be in core?
Currently, nothing nice prints. When dealing with AggregateErrors it would be better if each subsequent error was printed and formatted as well.
Benefits
The errors within the AggregateError will be nicely formatted when printed.
Possible Drawbacks
If an AggregateError contains a lot of errors, then a lot of errors will be printed!
Applicable issues
Nothing of note.