-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(esbuild-bundle-analyzer): address pnpm issues
- Loading branch information
Showing
6 changed files
with
44 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,11 @@ | ||
// Copied from metro-plugin-duplicates-checker/test/__mocks__/fs.js | ||
const fs = jest.createMockFromModule("node:fs"); | ||
const actualFs = jest.requireActual("node:fs"); | ||
|
||
// Under normal circumstances, this extra copy of '@react-native/polyfills' | ||
// should not be installed. | ||
const extraPolyfills = | ||
"/packages/test-app/node_modules/@react-native/polyfills"; | ||
|
||
fs.readFileSync = actualFs.readFileSync; | ||
|
||
fs.realpathSync = actualFs.realpathSync; | ||
const actualRealpathSyncNative = actualFs.realpathSync.native; | ||
fs.realpathSync.native = (path, ...args) => { | ||
if (path.replace(/\\/g, "/").endsWith(extraPolyfills)) { | ||
return path; | ||
} else { | ||
return actualRealpathSyncNative(path, ...args); | ||
} | ||
const fs = require("@rnx-kit/metro-plugin-duplicates-checker/test/__mocks__/fs.js"); | ||
const fsActual = jest.requireActual("fs"); | ||
|
||
const readFileSync = fs.readFileSync; | ||
fs.readFileSync = (p, options) => { | ||
return p.includes("__fixtures__") | ||
? fsActual.readFileSync(p, options) | ||
: readFileSync(p, options); | ||
}; | ||
|
||
fs.statSync = actualFs.statSync; // Used by 'pkg-dir' | ||
|
||
module.exports = fs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters