mirror of
https://github.com/status-im/metro.git
synced 2025-01-21 08:29:19 +00:00
metro-bundler: put __tests__ blacklisting into default blacklist instead
Summary: I'd like to get rid of the function as blacklist, because it's impossible to process properly at the `jest-haste-map` level (https://github.com/facebook/jest/pull/4047). The reason we use a function in Metro bundler is because we excludes all the `__tests__` modules. However, I removed this exclusion completely, and I could build our package without any problem and with no difference in the final bundle. I can only assume, then, that this line is only here for slightly increasing performance. Therefore, I think it's reasonnable to move it as part of the default blacklist shipped with Metro bundler instead. Reviewed By: cpojer Differential Revision: D5434351 fbshipit-source-id: dea39f6299985143d25fcb3b7b365d793acd64a9
This commit is contained in:
parent
40c4317086
commit
635e41027c
@ -73,10 +73,7 @@ class Resolver {
|
|||||||
const depGraphOpts = Object.assign(Object.create(opts), {
|
const depGraphOpts = Object.assign(Object.create(opts), {
|
||||||
assetDependencies: ['react-native/Libraries/Image/AssetRegistry'],
|
assetDependencies: ['react-native/Libraries/Image/AssetRegistry'],
|
||||||
forceNodeFilesystemAPI: false,
|
forceNodeFilesystemAPI: false,
|
||||||
ignoreFilePath(filepath) {
|
ignoreFilePath: opts.blacklistRE,
|
||||||
return filepath.indexOf('__tests__') !== -1 ||
|
|
||||||
(opts.blacklistRE != null && opts.blacklistRE.test(filepath));
|
|
||||||
},
|
|
||||||
moduleOptions: {
|
moduleOptions: {
|
||||||
hasteImpl: opts.hasteImpl,
|
hasteImpl: opts.hasteImpl,
|
||||||
resetCache: opts.resetCache,
|
resetCache: opts.resetCache,
|
||||||
|
@ -18,6 +18,8 @@ var sharedBlacklist = [
|
|||||||
/website\/node_modules\/.*/,
|
/website\/node_modules\/.*/,
|
||||||
|
|
||||||
/heapCapture\/bundle\.js/,
|
/heapCapture\/bundle\.js/,
|
||||||
|
|
||||||
|
/.*\/__tests__\/.*/,
|
||||||
];
|
];
|
||||||
|
|
||||||
function escapeRegExp(pattern) {
|
function escapeRegExp(pattern) {
|
||||||
|
@ -51,7 +51,7 @@ type Options = {|
|
|||||||
+forceNodeFilesystemAPI: boolean,
|
+forceNodeFilesystemAPI: boolean,
|
||||||
+getTransformCacheKey: GetTransformCacheKey,
|
+getTransformCacheKey: GetTransformCacheKey,
|
||||||
+globalTransformCache: ?GlobalTransformCache,
|
+globalTransformCache: ?GlobalTransformCache,
|
||||||
+ignoreFilePath: (filePath: string) => boolean,
|
+ignoreFilePath: RegExp,
|
||||||
+maxWorkers: number,
|
+maxWorkers: number,
|
||||||
+moduleOptions: ModuleOptions,
|
+moduleOptions: ModuleOptions,
|
||||||
+platforms: Set<string>,
|
+platforms: Set<string>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user