Skip to content

Commit

Permalink
test: add node-fetch as polifyll
Browse files Browse the repository at this point in the history
  • Loading branch information
manast committed Sep 10, 2024
1 parent e6afe2f commit 038107a
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"electrode-server": "^2.2.2",
"gulp": "^3.8.11",
"gulp-eslint": "^0.9.0",
"node-fetch": "^3.3.2",
"prettier": "^2.0.1",
"run-verify": "^1.2.2",
"vitest": "^2.0.5"
Expand Down
1 change: 0 additions & 1 deletion test/custom_resolver.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { describe, it, expect } from 'vitest';
import { Redbird } from '../'; // Adjust the import path if necessary
import { expect } from 'chai';
// import _ from 'lodash';

const opts = {
bunyan: false,
Expand Down
5 changes: 3 additions & 2 deletions test/hostheader.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import { describe, it, expect } from 'vitest';
import { Redbird } from '../'; // Adjust the import path if necessary
import { expect } from 'chai';
import { createServer } from 'http';
import { createServer } from 'http';
import fetch from 'node-fetch';

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

expect(res.status).to.be.eql(502);
} catch (e) {
expect(e.cause.code).to.be.eql('ECONNRESET');
expect(e.code).to.be.eql('ECONNRESET');
} finally {
await redbird.close();
}
Expand Down
1 change: 1 addition & 0 deletions test/onrequest.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { describe, it, expect } from 'vitest';
import { Redbird } from '../'; // Adjust the import path if necessary
import { expect } from 'chai';
import fetch from 'node-fetch';

const { asyncVerify, runFinally } = require('run-verify');
const electrodeServer = require('electrode-server');
Expand Down
39 changes: 39 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,11 @@ dashdash@^1.12.0:
dependencies:
assert-plus "^1.0.0"

data-uri-to-buffer@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e"
integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==

dateformat@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/dateformat/-/dateformat-2.0.0.tgz"
Expand Down Expand Up @@ -1189,6 +1194,14 @@ fast-safe-stringify@^2.0.7:
resolved "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz"
integrity sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==

fetch-blob@^3.1.2, fetch-blob@^3.1.4:
version "3.2.0"
resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9"
integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==
dependencies:
node-domexception "^1.0.0"
web-streams-polyfill "^3.0.3"

filename-regex@^2.0.0:
version "2.0.1"
resolved "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz"
Expand Down Expand Up @@ -1295,6 +1308,13 @@ form-data@~2.3.2:
combined-stream "^1.0.6"
mime-types "^2.1.12"

formdata-polyfill@^4.0.10:
version "4.0.10"
resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423"
integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==
dependencies:
fetch-blob "^3.1.2"

fs-exists-sync@^0.1.0:
version "0.1.0"
resolved "https://registry.npmjs.org/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz"
Expand Down Expand Up @@ -2295,6 +2315,11 @@ node-addon-api@^1.6.0:
resolved "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.6.2.tgz"
integrity sha512-479Bjw9nTE5DdBSZZWprFryHGjUaQC31y1wHo19We/k0BZlrmhqQitWoUL0cD8+scljCbIUL+E58oRDEakdGGA==

node-domexception@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"
integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==

node-etcd@^7.0.0:
version "7.0.0"
resolved "https://registry.npmjs.org/node-etcd/-/node-etcd-7.0.0.tgz"
Expand All @@ -2305,6 +2330,15 @@ node-etcd@^7.0.0:
request "^2.87.0"
url-parse "^1.4.3"

node-fetch@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.2.tgz#d1e889bacdf733b4ff3b2b243eb7a12866a0b78b"
integrity sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==
dependencies:
data-uri-to-buffer "^4.0.0"
fetch-blob "^3.1.4"
formdata-polyfill "^4.0.10"

normalize-path@^2.0.1:
version "2.1.1"
resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz"
Expand Down Expand Up @@ -3378,6 +3412,11 @@ wbuf@^1.1.0, wbuf@^1.7.3:
dependencies:
minimalistic-assert "^1.0.0"

web-streams-polyfill@^3.0.3:
version "3.3.3"
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b"
integrity sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==

which@^1.2.12:
version "1.3.0"
resolved "https://registry.npmjs.org/which/-/which-1.3.0.tgz"
Expand Down

0 comments on commit 038107a

Please sign in to comment.