Skip to content

Commit 038107a

Browse files
committed
test: add node-fetch as polifyll
1 parent e6afe2f commit 038107a

5 files changed

+44
-3
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"electrode-server": "^2.2.2",
4949
"gulp": "^3.8.11",
5050
"gulp-eslint": "^0.9.0",
51+
"node-fetch": "^3.3.2",
5152
"prettier": "^2.0.1",
5253
"run-verify": "^1.2.2",
5354
"vitest": "^2.0.5"

test/custom_resolver.spec.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { describe, it, expect } from 'vitest';
22
import { Redbird } from '../'; // Adjust the import path if necessary
33
import { expect } from 'chai';
4-
// import _ from 'lodash';
54

65
const opts = {
76
bunyan: false,

test/hostheader.spec.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
import { describe, it, expect } from 'vitest';
44
import { Redbird } from '../'; // Adjust the import path if necessary
55
import { expect } from 'chai';
6-
import { createServer } from 'http';
6+
import { createServer } from 'http';
7+
import fetch from 'node-fetch';
78

89
const TEST_PORT = 54674;
910
const PROXY_PORT = 53433;
@@ -97,7 +98,7 @@ describe('Target with a hostname', function () {
9798

9899
expect(res.status).to.be.eql(502);
99100
} catch (e) {
100-
expect(e.cause.code).to.be.eql('ECONNRESET');
101+
expect(e.code).to.be.eql('ECONNRESET');
101102
} finally {
102103
await redbird.close();
103104
}

test/onrequest.spec.js

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { describe, it, expect } from 'vitest';
44
import { Redbird } from '../'; // Adjust the import path if necessary
55
import { expect } from 'chai';
6+
import fetch from 'node-fetch';
67

78
const { asyncVerify, runFinally } = require('run-verify');
89
const electrodeServer = require('electrode-server');

yarn.lock

+39
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,11 @@ dashdash@^1.12.0:
761761
dependencies:
762762
assert-plus "^1.0.0"
763763

764+
data-uri-to-buffer@^4.0.0:
765+
version "4.0.1"
766+
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e"
767+
integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==
768+
764769
dateformat@^2.0.0:
765770
version "2.0.0"
766771
resolved "https://registry.npmjs.org/dateformat/-/dateformat-2.0.0.tgz"
@@ -1189,6 +1194,14 @@ fast-safe-stringify@^2.0.7:
11891194
resolved "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz"
11901195
integrity sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==
11911196

1197+
fetch-blob@^3.1.2, fetch-blob@^3.1.4:
1198+
version "3.2.0"
1199+
resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9"
1200+
integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==
1201+
dependencies:
1202+
node-domexception "^1.0.0"
1203+
web-streams-polyfill "^3.0.3"
1204+
11921205
filename-regex@^2.0.0:
11931206
version "2.0.1"
11941207
resolved "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz"
@@ -1295,6 +1308,13 @@ form-data@~2.3.2:
12951308
combined-stream "^1.0.6"
12961309
mime-types "^2.1.12"
12971310

1311+
formdata-polyfill@^4.0.10:
1312+
version "4.0.10"
1313+
resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423"
1314+
integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==
1315+
dependencies:
1316+
fetch-blob "^3.1.2"
1317+
12981318
fs-exists-sync@^0.1.0:
12991319
version "0.1.0"
13001320
resolved "https://registry.npmjs.org/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz"
@@ -2295,6 +2315,11 @@ node-addon-api@^1.6.0:
22952315
resolved "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.6.2.tgz"
22962316
integrity sha512-479Bjw9nTE5DdBSZZWprFryHGjUaQC31y1wHo19We/k0BZlrmhqQitWoUL0cD8+scljCbIUL+E58oRDEakdGGA==
22972317

2318+
node-domexception@^1.0.0:
2319+
version "1.0.0"
2320+
resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"
2321+
integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==
2322+
22982323
node-etcd@^7.0.0:
22992324
version "7.0.0"
23002325
resolved "https://registry.npmjs.org/node-etcd/-/node-etcd-7.0.0.tgz"
@@ -2305,6 +2330,15 @@ node-etcd@^7.0.0:
23052330
request "^2.87.0"
23062331
url-parse "^1.4.3"
23072332

2333+
node-fetch@^3.3.2:
2334+
version "3.3.2"
2335+
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.2.tgz#d1e889bacdf733b4ff3b2b243eb7a12866a0b78b"
2336+
integrity sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==
2337+
dependencies:
2338+
data-uri-to-buffer "^4.0.0"
2339+
fetch-blob "^3.1.4"
2340+
formdata-polyfill "^4.0.10"
2341+
23082342
normalize-path@^2.0.1:
23092343
version "2.1.1"
23102344
resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz"
@@ -3378,6 +3412,11 @@ wbuf@^1.1.0, wbuf@^1.7.3:
33783412
dependencies:
33793413
minimalistic-assert "^1.0.0"
33803414

3415+
web-streams-polyfill@^3.0.3:
3416+
version "3.3.3"
3417+
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b"
3418+
integrity sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==
3419+
33813420
which@^1.2.12:
33823421
version "1.3.0"
33833422
resolved "https://registry.npmjs.org/which/-/which-1.3.0.tgz"

0 commit comments

Comments
 (0)