sindresorhus / sindresorhus/aggregate-error
Make it more spec compliant
Open
Nobody has claimed this yet.
enhancement
help wanted
- Dominant language
- JavaScript
- Stars
- 247
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
When used with mocha the errors are displayed twice. Is there a way to have it only display once?
const AggregateError = require('aggregate-error')
it('should fail', function() {
throw new AggregateError([
new Error('first'),
new Error('second')
])
})
The report is
1) should fail
0 passing (12ms)
1 failing
1) should fail:
Error: first
at Context.<anonymous> (/Users/williamrusnack/Documents/event_sequencing/try_aggregate-error.js:5:5)
at callFn (/Users/williamrusnack/Documents/event_sequencing/node_modules/mocha/lib/runnable.js:354:21)
at Test.Runnable.run (/Users/williamrusnack/Documents/event_sequencing/node_modules/mocha/lib/runnable.js:346:7)
at Runner.runTest (/Users/williamrusnack/Documents/event_sequencing/node_modules/mocha/lib/runner.js:442:10)
at /Users/williamrusnack/Documents/event_sequencing/node_modules/mocha/lib/runner.js:560:12
at next (/Users/williamrusnack/Documents/event_sequencing/node_modules/mocha/lib/runner.js:356:14)
at /Users/williamrusnack/Documents/event_sequencing/node_modules/mocha/lib/runner.js:366:7
at next (/Users/williamrusnack/Documents/event_sequencing/node_modules/mocha/lib/runner.js:290:14)
at Immediate.<anonymous> (/Users/williamrusnack/Documents/event_sequencing/node_modules/mocha/lib/runner.js:334:5)
Error: second
at Context.<anonymous> (/Users/williamrusnack/Documents/event_sequencing/try_aggregate-error.js:6:5)
at callFn (/Users/williamrusnack/Documents/event_sequencing/node_modules/mocha/lib/runnable.js:354:21)
at Test.Runnable.run (/Users/williamrusnack/Documents/event_sequencing/node_modules/mocha/lib/runnable.js:346:7)
at Runner.runTest (/Users/williamrusnack/Documents/event_sequencing/node_modules/mocha/lib/runner.js:442:10)
at /Users/williamrusnack/Documents/event_sequencing/node_modules/mocha/lib/runner.js:560:12
at next (/Users/williamrusnack/Documents/event_sequencing/node_modules/mocha/lib/runner.js:356:14)
at /Users/williamrusnack/Documents/event_sequencing/node_modules/mocha/lib/runner.js:366:7
at next (/Users/williamrusnack/Documents/event_sequencing/node_modules/mocha/lib/runner.js:290:14)
at Immediate.<anonymous> (/Users/williamrusnack/Documents/event_sequencing/node_modules/mocha/lib/runner.js:334:5)
AggregateError:
Error: first
at Context.<anonymous> (try_aggregate-error.js:5:5)
Error: second
at Context.<anonymous> (try_aggregate-error.js:6:5)
at Context.<anonymous> (try_aggregate-error.js:4:9)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the shown AggregateError output with the provided Mocha test and inspect the package's error-formatting entry point. Determine why the individual errors and aggregate error are both rendered, then add or update coverage for the reproduction so the output contains each error only once.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100