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:
Jean Lauliac 2017-07-17 11:09:47 -07:00 committed by Facebook Github Bot
parent 40c4317086
commit 635e41027c
3 changed files with 4 additions and 5 deletions

View File

@ -73,10 +73,7 @@ class Resolver {
const depGraphOpts = Object.assign(Object.create(opts), {
assetDependencies: ['react-native/Libraries/Image/AssetRegistry'],
forceNodeFilesystemAPI: false,
ignoreFilePath(filepath) {
return filepath.indexOf('__tests__') !== -1 ||
(opts.blacklistRE != null && opts.blacklistRE.test(filepath));
},
ignoreFilePath: opts.blacklistRE,
moduleOptions: {
hasteImpl: opts.hasteImpl,
resetCache: opts.resetCache,

View File

@ -18,6 +18,8 @@ var sharedBlacklist = [
/website\/node_modules\/.*/,
/heapCapture\/bundle\.js/,
/.*\/__tests__\/.*/,
];
function escapeRegExp(pattern) {

View File

@ -51,7 +51,7 @@ type Options = {|
+forceNodeFilesystemAPI: boolean,
+getTransformCacheKey: GetTransformCacheKey,
+globalTransformCache: ?GlobalTransformCache,
+ignoreFilePath: (filePath: string) => boolean,
+ignoreFilePath: RegExp,
+maxWorkers: number,
+moduleOptions: ModuleOptions,
+platforms: Set<string>,