Skip to content

Commit df88787

Browse files
Drop aggregate-error dependency and require Node.js 16 (#65)
Co-authored-by: Sindre Sorhus <[email protected]>
1 parent a5faf42 commit df88787

File tree

4 files changed

+10
-16
lines changed

4 files changed

+10
-16
lines changed

.github/workflows/main.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13+
- 20
14+
- 18
1315
- 16
14-
- 14
15-
- 12
1616
steps:
17-
- uses: actions/checkout@v2
18-
- uses: actions/setup-node@v2
17+
- uses: actions/checkout@v3
18+
- uses: actions/setup-node@v3
1919
with:
2020
node-version: ${{ matrix.node-version }}
2121
- run: npm install

index.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import AggregateError from 'aggregate-error';
2-
31
/**
42
An error to be thrown when the request is aborted by AbortController.
53
DOMException is thrown instead of this Error when DOMException is available.
@@ -99,7 +97,7 @@ export default async function pMap(
9997

10098
if (resolvingCount === 0 && !isResolved) {
10199
if (!stopOnError && errors.length > 0) {
102-
reject(new AggregateError(errors));
100+
reject(new AggregateError(errors)); // eslint-disable-line unicorn/error-message
103101
return;
104102
}
105103

package.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"type": "module",
1414
"exports": "./index.js",
1515
"engines": {
16-
"node": ">=12"
16+
"node": ">=16"
1717
},
1818
"scripts": {
1919
"test": "xo && ava && tsd"
@@ -40,9 +40,6 @@
4040
"parallel",
4141
"bluebird"
4242
],
43-
"dependencies": {
44-
"aggregate-error": "^4.0.0"
45-
},
4643
"devDependencies": {
4744
"ava": "^4.1.0",
4845
"delay": "^5.0.0",

test.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import delay from 'delay';
33
import inRange from 'in-range';
44
import timeSpan from 'time-span';
55
import randomInt from 'random-int';
6-
import AggregateError from 'aggregate-error';
76
import pMap, {pMapSkip} from './index.js';
87

98
const sharedInput = [
@@ -143,8 +142,8 @@ test('immediately rejects when stopOnError is true', async t => {
143142

144143
test('aggregate errors when stopOnError is false', async t => {
145144
await t.notThrowsAsync(pMap(sharedInput, mapper, {concurrency: 1, stopOnError: false}));
146-
await t.throwsAsync(pMap(errorInput1, mapper, {concurrency: 1, stopOnError: false}), {instanceOf: AggregateError, message: /foo(.|\n)*bar/});
147-
await t.throwsAsync(pMap(errorInput2, mapper, {concurrency: 1, stopOnError: false}), {instanceOf: AggregateError, message: /bar(.|\n)*foo/});
145+
await t.throwsAsync(pMap(errorInput1, mapper, {concurrency: 1, stopOnError: false}), {instanceOf: AggregateError, message: ''});
146+
await t.throwsAsync(pMap(errorInput2, mapper, {concurrency: 1, stopOnError: false}), {instanceOf: AggregateError, message: ''});
148147
});
149148

150149
test('pMapSkip', async t => {
@@ -279,8 +278,8 @@ test('asyncIterator - immediately rejects when stopOnError is true', async t =>
279278

280279
test('asyncIterator - aggregate errors when stopOnError is false', async t => {
281280
await t.notThrowsAsync(pMap(new AsyncTestData(sharedInput), mapper, {concurrency: 1, stopOnError: false}));
282-
await t.throwsAsync(pMap(new AsyncTestData(errorInput1), mapper, {concurrency: 1, stopOnError: false}), {instanceOf: AggregateError, message: /foo(.|\n)*bar/});
283-
await t.throwsAsync(pMap(new AsyncTestData(errorInput2), mapper, {concurrency: 1, stopOnError: false}), {instanceOf: AggregateError, message: /bar(.|\n)*foo/});
281+
await t.throwsAsync(pMap(new AsyncTestData(errorInput1), mapper, {concurrency: 1, stopOnError: false}), {instanceOf: AggregateError, message: ''});
282+
await t.throwsAsync(pMap(new AsyncTestData(errorInput2), mapper, {concurrency: 1, stopOnError: false}), {instanceOf: AggregateError, message: ''});
284283
});
285284

286285
test('asyncIterator - pMapSkip', async t => {

0 commit comments

Comments
 (0)