mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
bump @metamask/controllers to v15.0.2 and remove AbortController workaround in e2e tests (#11988)
* bump @metamask/controllers to v15.0.1 and remove AbortController workaround in e2e tests * remove old abortcontroller polyfill * bump @metamask/controllers to v15.0.2
This commit is contained in:
parent
da305656bd
commit
e8ab578ed0
@ -2,9 +2,6 @@
|
|||||||
* @file The entry point for the web extension singleton process.
|
* @file The entry point for the web extension singleton process.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// polyfills
|
|
||||||
import 'abortcontroller-polyfill/dist/polyfill-patch-fetch';
|
|
||||||
|
|
||||||
import endOfStream from 'end-of-stream';
|
import endOfStream from 'end-of-stream';
|
||||||
import pump from 'pump';
|
import pump from 'pump';
|
||||||
import debounce from 'debounce-stream';
|
import debounce from 'debounce-stream';
|
||||||
|
@ -109,7 +109,6 @@ describe('MetaMaskController', function () {
|
|||||||
const noop = () => undefined;
|
const noop = () => undefined;
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
globalThis.AbortController = window.AbortController;
|
|
||||||
await ganacheServer.start();
|
await ganacheServer.start();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -158,7 +157,6 @@ describe('MetaMaskController', function () {
|
|||||||
|
|
||||||
after(async function () {
|
after(async function () {
|
||||||
await ganacheServer.quit();
|
await ganacheServer.quit();
|
||||||
delete globalThis.AbortController;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#getAccounts', function () {
|
describe('#getAccounts', function () {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
// polyfills
|
// polyfills
|
||||||
import 'abortcontroller-polyfill/dist/polyfill-patch-fetch';
|
|
||||||
import '@formatjs/intl-relativetimeformat/polyfill';
|
import '@formatjs/intl-relativetimeformat/polyfill';
|
||||||
|
|
||||||
// dev only, "react-devtools" import is skipped in prod builds
|
// dev only, "react-devtools" import is skipped in prod builds
|
||||||
|
@ -104,7 +104,7 @@
|
|||||||
"@fortawesome/fontawesome-free": "^5.13.0",
|
"@fortawesome/fontawesome-free": "^5.13.0",
|
||||||
"@material-ui/core": "^4.11.0",
|
"@material-ui/core": "^4.11.0",
|
||||||
"@metamask/contract-metadata": "^1.28.0",
|
"@metamask/contract-metadata": "^1.28.0",
|
||||||
"@metamask/controllers": "^15.0.0",
|
"@metamask/controllers": "^15.0.2",
|
||||||
"@metamask/eth-ledger-bridge-keyring": "^0.7.0",
|
"@metamask/eth-ledger-bridge-keyring": "^0.7.0",
|
||||||
"@metamask/eth-token-tracker": "^3.0.1",
|
"@metamask/eth-token-tracker": "^3.0.1",
|
||||||
"@metamask/etherscan-link": "^2.1.0",
|
"@metamask/etherscan-link": "^2.1.0",
|
||||||
@ -118,7 +118,6 @@
|
|||||||
"@sentry/browser": "^5.26.0",
|
"@sentry/browser": "^5.26.0",
|
||||||
"@sentry/integrations": "^5.26.0",
|
"@sentry/integrations": "^5.26.0",
|
||||||
"@zxing/library": "^0.8.0",
|
"@zxing/library": "^0.8.0",
|
||||||
"abortcontroller-polyfill": "^1.4.0",
|
|
||||||
"analytics-node": "^3.4.0-beta.3",
|
"analytics-node": "^3.4.0-beta.3",
|
||||||
"await-semaphore": "^0.1.1",
|
"await-semaphore": "^0.1.1",
|
||||||
"base32-encode": "^1.2.0",
|
"base32-encode": "^1.2.0",
|
||||||
|
@ -30,7 +30,9 @@ describe('getFetchWithTimeout', function () {
|
|||||||
throw new Error('Request should throw');
|
throw new Error('Request should throw');
|
||||||
};
|
};
|
||||||
|
|
||||||
await expect(fetchWithTimeoutThrowsError()).rejects.toThrow('Aborted');
|
await expect(fetchWithTimeoutThrowsError()).rejects.toThrow(
|
||||||
|
'The user aborted a request.',
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should abort the request when the custom timeout is hit', async function () {
|
it('should abort the request when the custom timeout is hit', async function () {
|
||||||
@ -48,7 +50,9 @@ describe('getFetchWithTimeout', function () {
|
|||||||
throw new Error('Request should be aborted');
|
throw new Error('Request should be aborted');
|
||||||
};
|
};
|
||||||
|
|
||||||
await expect(fetchWithTimeoutThrowsError()).rejects.toThrow('Aborted');
|
await expect(fetchWithTimeoutThrowsError()).rejects.toThrow(
|
||||||
|
'The user aborted a request.',
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throws on invalid timeout', async function () {
|
it('throws on invalid timeout', async function () {
|
||||||
|
@ -56,17 +56,12 @@ const popoverContent = window.document.createElement('div');
|
|||||||
popoverContent.setAttribute('id', 'popover-content');
|
popoverContent.setAttribute('id', 'popover-content');
|
||||||
window.document.body.appendChild(popoverContent);
|
window.document.body.appendChild(popoverContent);
|
||||||
|
|
||||||
// delete AbortController added by jsdom so it can be polyfilled correctly below
|
|
||||||
delete window.AbortController;
|
|
||||||
|
|
||||||
// fetch
|
// fetch
|
||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
|
|
||||||
const { Headers, Request, Response } = fetch;
|
const { Headers, Request, Response } = fetch;
|
||||||
Object.assign(window, { fetch, Headers, Request, Response });
|
Object.assign(window, { fetch, Headers, Request, Response });
|
||||||
|
|
||||||
require('abortcontroller-polyfill/dist/polyfill-patch-fetch');
|
|
||||||
|
|
||||||
// localStorage
|
// localStorage
|
||||||
window.localStorage = {
|
window.localStorage = {
|
||||||
removeItem: () => null,
|
removeItem: () => null,
|
||||||
|
@ -79,7 +79,10 @@ describe('Fetch with cache', () => {
|
|||||||
{},
|
{},
|
||||||
{ timeout: 20 },
|
{ timeout: 20 },
|
||||||
),
|
),
|
||||||
).rejects.toThrow({ name: 'AbortError', message: 'Aborted' });
|
).rejects.toThrow({
|
||||||
|
name: 'AbortError',
|
||||||
|
message: 'The user aborted a request.',
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throws when the response is unsuccessful', async () => {
|
it('throws when the response is unsuccessful', async () => {
|
||||||
|
14
yarn.lock
14
yarn.lock
@ -2730,15 +2730,16 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-1.29.0.tgz#4ca86a2f03d4dad4350d09216a7fe92f9dd21c8e"
|
resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-1.29.0.tgz#4ca86a2f03d4dad4350d09216a7fe92f9dd21c8e"
|
||||||
integrity sha512-wxsC0ZCyhPKqThvmsL8+2zVWGWPqofSo8HNtOuOnQM9oGbXX9294imJ3T+A/Lov8fkX4jAWZOeNV0uR80zkNtA==
|
integrity sha512-wxsC0ZCyhPKqThvmsL8+2zVWGWPqofSo8HNtOuOnQM9oGbXX9294imJ3T+A/Lov8fkX4jAWZOeNV0uR80zkNtA==
|
||||||
|
|
||||||
"@metamask/controllers@^15.0.0":
|
"@metamask/controllers@^15.0.2":
|
||||||
version "15.0.0"
|
version "15.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/@metamask/controllers/-/controllers-15.0.0.tgz#b7e816e12e02debaf32f7bab5f8d612cbd7a5170"
|
resolved "https://registry.yarnpkg.com/@metamask/controllers/-/controllers-15.0.2.tgz#b4012a8bf28bd2c8dbb3c96f4d934d6cf1bb778c"
|
||||||
integrity sha512-vYVwDVctxdmBRBYDzPfpab3GoVtePykaMKfOdgD+OT8Cz8tlDrEIRc5+DZhr6HembWg8LkNfw9Gh5lKfAFSGLg==
|
integrity sha512-MPxfZ2OOTzEa5lUzDsSkINtlTDU4q4udjpBNM5Dq1yCnLKIuPKzYC5nl/rA88Ssr9Hs6babCtMbnUpbbjQjLOg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@ethereumjs/common" "^2.3.1"
|
"@ethereumjs/common" "^2.3.1"
|
||||||
"@ethereumjs/tx" "^3.2.1"
|
"@ethereumjs/tx" "^3.2.1"
|
||||||
"@metamask/contract-metadata" "^1.29.0"
|
"@metamask/contract-metadata" "^1.29.0"
|
||||||
"@types/uuid" "^8.3.0"
|
"@types/uuid" "^8.3.0"
|
||||||
|
abort-controller "^3.0.0"
|
||||||
async-mutex "^0.2.6"
|
async-mutex "^0.2.6"
|
||||||
babel-runtime "^6.26.0"
|
babel-runtime "^6.26.0"
|
||||||
eth-ens-namehash "^2.0.8"
|
eth-ens-namehash "^2.0.8"
|
||||||
@ -4642,11 +4643,6 @@ abort-controller@^3.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
event-target-shim "^5.0.0"
|
event-target-shim "^5.0.0"
|
||||||
|
|
||||||
abortcontroller-polyfill@^1.4.0:
|
|
||||||
version "1.4.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.4.0.tgz#0d5eb58e522a461774af8086414f68e1dda7a6c4"
|
|
||||||
integrity sha512-3ZFfCRfDzx3GFjO6RAkYx81lPGpUS20ISxux9gLxuKnqafNcFQo59+IoZqpO2WvQlyc287B62HDnDdNYRmlvWA==
|
|
||||||
|
|
||||||
abstract-leveldown@0.12.3:
|
abstract-leveldown@0.12.3:
|
||||||
version "0.12.3"
|
version "0.12.3"
|
||||||
resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-0.12.3.tgz#116b1ec5c7710ef7a2d5706768bbdb4440be1070"
|
resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-0.12.3.tgz#116b1ec5c7710ef7a2d5706768bbdb4440be1070"
|
||||||
|
Loading…
Reference in New Issue
Block a user