mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Replace metro-memory-fs dependency in tests with OSS memfs (#52572)
Summary: We'd like to stop supporting `metro-memory-fs` - there are better alternatives out there. This replaces the one usage of `metro-memory-fs` in `react-native` with `memfs`, and swaps the dependency. Changelog: [Internal] Reviewed By: vzaidman Differential Revision: D78161921
This commit is contained in:
committed by
Facebook GitHub Bot
parent
77db9343b1
commit
a96d2068f3
+1
-1
@@ -93,8 +93,8 @@
|
||||
"jest-snapshot": "^29.7.0",
|
||||
"markdownlint-cli2": "^0.17.2",
|
||||
"markdownlint-rule-relative-links": "^3.0.0",
|
||||
"memfs": "^4.7.7",
|
||||
"metro-babel-register": "^0.82.5",
|
||||
"metro-memory-fs": "^0.82.5",
|
||||
"metro-transform-plugins": "^0.82.5",
|
||||
"micromatch": "^4.0.4",
|
||||
"node-fetch": "^2.2.0",
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import typeof FS from 'fs';
|
||||
|
||||
import * as path from 'path';
|
||||
|
||||
const {
|
||||
@@ -25,9 +27,12 @@ const {
|
||||
setHermesTag,
|
||||
shouldUsePrebuiltHermesC,
|
||||
} = require('../hermes-utils');
|
||||
const MemoryFs = require('metro-memory-fs');
|
||||
const os = require('os');
|
||||
|
||||
// $FlowFixMe[untyped-import] (OSS) memfs
|
||||
// $FlowFixMe[cannot-resolve-module] (Meta) memfs
|
||||
const {memfs} = require('memfs') as {memfs: () => {fs: FS}};
|
||||
|
||||
const hermesTag =
|
||||
'hermes-2022-04-28-RNv0.69.0-15d07c2edd29a4ea0b8f15ab0588a0c1adb1200f';
|
||||
const tarballContents = 'dummy string';
|
||||
@@ -147,16 +152,8 @@ describe('hermes-utils', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
|
||||
jest.mock(
|
||||
'fs',
|
||||
() =>
|
||||
new MemoryFs({
|
||||
platform: process.platform === 'win32' ? 'win32' : 'posix',
|
||||
}),
|
||||
);
|
||||
jest.mock('fs', () => memfs().fs);
|
||||
fs = require('fs');
|
||||
// $FlowFixMe[prop-missing]
|
||||
fs.reset();
|
||||
|
||||
populateMockFilesystemWithHermesBuildScripts();
|
||||
|
||||
|
||||
@@ -6823,6 +6823,13 @@ memfs-or-file-map-to-github-branch@^1.3.0:
|
||||
dependencies:
|
||||
"@octokit/rest" "*"
|
||||
|
||||
memfs@^4.7.7:
|
||||
version "4.7.7"
|
||||
resolved "https://registry.yarnpkg.com/memfs/-/memfs-4.7.7.tgz#bcf09cab1646d655f659e7cf832dfc75ccb95b2d"
|
||||
integrity sha512-x9qc6k88J/VVwnfTkJV8pRRswJ2156Rc4w5rciRqKceFDZ0y1MqsNL9pkg5sE0GOcDzZYbonreALhaHzg1siFw==
|
||||
dependencies:
|
||||
tslib "^2.0.0"
|
||||
|
||||
memoize-one@^5.0.0:
|
||||
version "5.2.1"
|
||||
resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-5.2.1.tgz#8337aa3c4335581839ec01c3d594090cebe8f00e"
|
||||
@@ -6920,13 +6927,6 @@ metro-file-map@0.82.5:
|
||||
nullthrows "^1.1.1"
|
||||
walker "^1.0.7"
|
||||
|
||||
metro-memory-fs@^0.82.5:
|
||||
version "0.82.5"
|
||||
resolved "https://registry.yarnpkg.com/metro-memory-fs/-/metro-memory-fs-0.82.5.tgz#ae6c4c251cd6dc9cf44540c3b1356cff54db875e"
|
||||
integrity sha512-yMYtBwDtG84vnDfQDEGZ3EUYbHng4dMZX2AKSQFQOMdd34lyQcD1yV5yrrUTG/DqMKDxJGqmxDkeyqTlKwwuUA==
|
||||
dependencies:
|
||||
flow-enums-runtime "^0.0.6"
|
||||
|
||||
metro-minify-terser@0.82.5:
|
||||
version "0.82.5"
|
||||
resolved "https://registry.yarnpkg.com/metro-minify-terser/-/metro-minify-terser-0.82.5.tgz#5dc77d53b6ef4079bd9c752ae046d557df4ae584"
|
||||
@@ -9191,6 +9191,11 @@ tslib@^1.8.1, tslib@^1.9.0:
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
|
||||
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
|
||||
|
||||
tslib@^2.0.0:
|
||||
version "2.8.1"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f"
|
||||
integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==
|
||||
|
||||
tslib@^2.1.0:
|
||||
version "2.7.0"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01"
|
||||
|
||||
Reference in New Issue
Block a user