Skip to content

Commit

Permalink
chore: use AggregateErrorPonyfill consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed May 21, 2022
1 parent 0ab3996 commit 7478246
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/vitest/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,12 @@ export function getCallLastIndex(code: string) {

export { resolve as resolvePath }

// AggregateError is supported in Node.js 15.0.0+
class AggregateErrorPonyfill extends Error {
errors: unknown[]
constructor(errors: Iterable<unknown>, message = '') {
super(message)
this.errors = [...errors]
}
}

// AggregateError is supported in Node.js 15.0.0+
export const AggregateError = global.AggregateError || AggregateErrorPonyfill
export { AggregateErrorPonyfill as AggregateError }

0 comments on commit 7478246

Please sign in to comment.