Skip to content
Merged
2 changes: 0 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ npmAuditIgnoreAdvisories:
# decode-uri-component (MCWP-1049)
- '1147955' # GHSA-vcc3-ghjq-m6fr moderate
- '1243857' # GHSA-qr28-fpjm-wq7f high
# @graphql-tools/utils (MCWP-1041)
- '1241230' # GHSA-7mx3-vvmw-hjmv high
# uuid (MCWP-1064) - accepted risk, not reachable. The bug needs v3/v5/v6
# called with a caller-provided buffer; app code uses uuid 14 (patched) and no
# dependency imports v3/v5/v6. A fix would force ~40 packages to uuid 11.1.1+.
Expand Down
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ const DEPENDENCIES_TO_TRANSPILE = [
'@mswjs/interceptors',
'@open-draft/until',
'rettime',
// mockttp 4.x depends on ESM-only milliparsec and get-port 7 (installed nested under mockttp).
'milliparsec',
'mockttp/node_modules/get-port',
'get-port',
'react-native-wagmi-charts',
'react-native-nitro-modules',
'@notifee',
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
"@react-native-community/viewpager": "patch:@react-native-community/viewpager@npm%3A3.3.0#~/.yarn/patches/@react-native-community-viewpager-npm-3.3.0.patch",
"@solana-mobile/mobile-wallet-adapter-protocol": "^2.2.5",
"@appium/schema/json-schema": "^0.4.0",
"@metamask/react-native-payments/validator": "^13.7.0",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

react-native-payments does not use validator anymore

"@unrs/resolver-binding-wasm32-wasi": "npm:npm-empty-package@1.0.0",
"d3-color": "3.1.0",
"napi-postinstall": "npm:npm-empty-package@1.0.0",
Expand Down Expand Up @@ -351,7 +350,6 @@
"@reown/appkit-wallet@npm:1.7.2/zod": "4.6.7",
"@open-rpc/server-js@npm:1.9.3/body-parser": "1.20.9",
"express@npm:4.22.2/body-parser": "1.20.9",
"mockttp@npm:3.15.2/body-parser": "1.20.9",
"@metamask/ramps-controller@npm:^31.0.0": "patch:@metamask/ramps-controller@npm%3A31.0.0#~/.yarn/patches/@metamask-ramps-controller-npm-31.0.0-f6724f4eac.patch"
},
"dependencies": {
Expand Down Expand Up @@ -612,7 +610,7 @@
"lodash": "4.18.1",
"lottie-react-native": "~7.3.8",
"luxon": "^3.5.0",
"mockttp": "^3.15.2",
"mockttp": "^4.6.5",
"multihashes": "0.4.14",
"number-to-bn": "1.7.0",
"pako": "^2.1.0",
Expand Down Expand Up @@ -985,7 +983,8 @@
"@metamask/transaction-pay-controller>@metamask/keyring-controller>ethereumjs-wallet>ethereum-cryptography>keccak": false,
"eas-cli>@expo/logger>bunyan>dtrace-provider": false,
"appium-uiautomator2-driver>appium-android-driver>appium-chromedriver>@appium/base-driver>@appium/support>sharp": false,
"appium-xcuitest-driver>appium-ios-remotexpc>appium-ios-tuntap": false
"appium-xcuitest-driver>appium-ios-remotexpc>appium-ios-tuntap": false,
"mockttp>tls-impersonate": false
}
},
"packageManager": "yarn@4.14.1+sha256.5c7a0c5ea1c5b690df603c8e16b3742f87169b814d56bb5e63881145e8a84033",
Expand Down
3 changes: 3 additions & 0 deletions tests/api-mocking/define-api-mock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
SPEC_MOCK_PRIORITY,
} from './define-api-mock.ts';
import { setupMockRequest } from './helpers/mockHelpers.ts';
import { installCryptoRandomUUID } from './helpers/cryptoRandomUUID.ts';
import {
API_MOCKS,
accountsSupportedNetworksV2,
Expand All @@ -13,6 +14,8 @@ import {
spotPrice,
} from './api-mocks.ts';

beforeAll(installCryptoRandomUUID);

interface Item {
name: string;
nested: { a: number; b: number };
Expand Down
11 changes: 11 additions & 0 deletions tests/api-mocking/helpers/cryptoRandomUUID.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable import-x/no-nodejs-modules */
import { randomUUID } from 'node:crypto';

/**
* mockttp 4 calls `globalThis.crypto.randomUUID()`, which the shared Jest
* crypto stub in `app/util/test/testSetup.js` does not provide. Call this in
* unit tests that start a local mockttp server.
*/
export const installCryptoRandomUUID = (): void => {
globalThis.crypto.randomUUID = randomUUID;
};
3 changes: 3 additions & 0 deletions tests/api-mocking/helpers/mockHelpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import {
setupMockRequest,
type SeenProxiedRequest,
} from './mockHelpers.ts';
import { installCryptoRandomUUID } from './cryptoRandomUUID.ts';

beforeAll(installCryptoRandomUUID);

describe('processPostRequestBody', () => {
describe('basic functionality', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { getLocal, type Mockttp } from 'mockttp';
import { QAMockOAuthService } from '../../../app/core/OAuthService/QAMockOAuthService';
import { AuthServer } from './constants';
import { createOAuthMockttpService } from './OAuthMockttpService';
import { installCryptoRandomUUID } from '../helpers/cryptoRandomUUID';

beforeAll(installCryptoRandomUUID);

describe('OAuthMockttpService', () => {
let mockServer: Mockttp;
Expand Down
2 changes: 1 addition & 1 deletion tests/smoke/identity/utils/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async function mockAPICall(server: Mockttp, response: MockResponse) {
const decodedPath = getDecodedProxiedURL(url);

const [requestBodyJson, requestBodyText] = await Promise.all([
body.getJson(),
body.getJson<object>(),
body.getText(),
]);
const requestBody = requestBodyJson ?? requestBodyText;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { CompletedBody, getLocal, Mockttp } from 'mockttp';
import { UserStorageMockttpController } from './userStorageMockttpController';
import { USER_STORAGE_FEATURE_NAMES } from '@metamask/profile-sync-controller/sdk';
import { MOCK_SRP_E2E_IDENTIFIER_BASE_KEY } from '../mocks';
import { installCryptoRandomUUID } from '../../../../api-mocking/helpers/cryptoRandomUUID';

beforeAll(installCryptoRandomUUID);

describe('UserStorageMockttpController', () => {
let mockServer: Mockttp;
Expand Down
Loading
Loading