Prefer native node fetch over node-fetch
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>t3chguy/native-fetch
parent
386b782f2a
commit
19038a42cd
|
@ -203,7 +203,6 @@
|
||||||
"@types/minimist": "^1.2.5",
|
"@types/minimist": "^1.2.5",
|
||||||
"@types/modernizr": "^3.5.3",
|
"@types/modernizr": "^3.5.3",
|
||||||
"@types/node": "18",
|
"@types/node": "18",
|
||||||
"@types/node-fetch": "^2.6.2",
|
|
||||||
"@types/pako": "^2.0.0",
|
"@types/pako": "^2.0.0",
|
||||||
"@types/qrcode": "^1.3.5",
|
"@types/qrcode": "^1.3.5",
|
||||||
"@types/react": "18.3.3",
|
"@types/react": "18.3.3",
|
||||||
|
@ -268,7 +267,6 @@
|
||||||
"mkdirp": "^3.0.0",
|
"mkdirp": "^3.0.0",
|
||||||
"mocha-junit-reporter": "^2.2.0",
|
"mocha-junit-reporter": "^2.2.0",
|
||||||
"modernizr": "^3.12.0",
|
"modernizr": "^3.12.0",
|
||||||
"node-fetch": "^2.6.7",
|
|
||||||
"playwright-core": "^1.45.1",
|
"playwright-core": "^1.45.1",
|
||||||
"postcss": "8.4.38",
|
"postcss": "8.4.38",
|
||||||
"postcss-easings": "^4.0.0",
|
"postcss-easings": "^4.0.0",
|
||||||
|
|
|
@ -8,7 +8,6 @@ Please see LICENSE files in the repository root for full details.
|
||||||
|
|
||||||
import fetchMock from "fetch-mock-jest";
|
import fetchMock from "fetch-mock-jest";
|
||||||
import { TextDecoder, TextEncoder } from "util";
|
import { TextDecoder, TextEncoder } from "util";
|
||||||
import { Response } from "node-fetch";
|
|
||||||
|
|
||||||
import { mocks } from "./mocks";
|
import { mocks } from "./mocks";
|
||||||
|
|
||||||
|
@ -80,8 +79,5 @@ fetchMock.get("/_matrix/client/versions", {});
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
window.fetch = fetchMock.sandbox();
|
window.fetch = fetchMock.sandbox();
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
window.Response = Response;
|
|
||||||
|
|
||||||
// set up AudioContext API mock
|
// set up AudioContext API mock
|
||||||
global.AudioContext = jest.fn().mockImplementation(() => ({ ...mocks.AudioContext }));
|
global.AudioContext = jest.fn().mockImplementation(() => ({ ...mocks.AudioContext }));
|
||||||
|
|
|
@ -98,8 +98,11 @@ describe("getVectorConfig()", () => {
|
||||||
fetchMock.getOnce("express:/config.app.element.io.json", { throws: "err-specific" });
|
fetchMock.getOnce("express:/config.app.element.io.json", { throws: "err-specific" });
|
||||||
fetchMock.getOnce("express:/config.json", '{"invalid": "json",}');
|
fetchMock.getOnce("express:/config.json", '{"invalid": "json",}');
|
||||||
|
|
||||||
// We can't assert it'll be a SyntaxError as node-fetch behaves differently
|
await expect(getVectorConfig()).rejects.toThrow(
|
||||||
// https://github.com/wheresrhys/fetch-mock/issues/270
|
new SyntaxError(
|
||||||
await expect(getVectorConfig()).rejects.toThrow("in JSON at position 19");
|
"invalid json response body at https://app.element.io/config.json?cachebuster=1234567890 reason: " +
|
||||||
|
"Expected double-quoted property name in JSON at position 19 (line 1 column 20)",
|
||||||
|
),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -3012,14 +3012,6 @@
|
||||||
resolved "https://registry.yarnpkg.com/@types/modernizr/-/modernizr-3.5.6.tgz#c50d64a73edc30284679f09ad54e7d095e69f2a0"
|
resolved "https://registry.yarnpkg.com/@types/modernizr/-/modernizr-3.5.6.tgz#c50d64a73edc30284679f09ad54e7d095e69f2a0"
|
||||||
integrity sha512-yslwR0zZ3zAT1qXcCPxIcD23CZ6W6nKsl6JufSJHAmdwOBuYwCVJkaMsEo9yzxGV7ATfoX8S+RgtnajOEtKxYA==
|
integrity sha512-yslwR0zZ3zAT1qXcCPxIcD23CZ6W6nKsl6JufSJHAmdwOBuYwCVJkaMsEo9yzxGV7ATfoX8S+RgtnajOEtKxYA==
|
||||||
|
|
||||||
"@types/node-fetch@^2.6.2":
|
|
||||||
version "2.6.11"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.11.tgz#9b39b78665dae0e82a08f02f4967d62c66f95d24"
|
|
||||||
integrity sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==
|
|
||||||
dependencies:
|
|
||||||
"@types/node" "*"
|
|
||||||
form-data "^4.0.0"
|
|
||||||
|
|
||||||
"@types/node-forge@^1.3.0":
|
"@types/node-forge@^1.3.0":
|
||||||
version "1.3.11"
|
version "1.3.11"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node-forge/-/node-forge-1.3.11.tgz#0972ea538ddb0f4d9c2fa0ec5db5724773a604da"
|
resolved "https://registry.yarnpkg.com/@types/node-forge/-/node-forge-1.3.11.tgz#0972ea538ddb0f4d9c2fa0ec5db5724773a604da"
|
||||||
|
|
Loading…
Reference in New Issue