Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/cli/src/tools/loadMetroConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import path from 'path';
import {createBlacklist} from 'metro';
import {loadConfig} from 'metro-config';
import {existsSync} from 'fs';
import {type ConfigT} from 'types';
import findSymlinkedModules from './findSymlinkedModules';

Expand All @@ -31,13 +32,16 @@ const getBlacklistRE = () => createBlacklist([/.*\/__fixtures__\/.*/]);
* Otherwise, a.native.js will not load on Windows or other platforms
*/
export const getDefaultConfig = (ctx: ConfigT) => {
const hasteImplPath = path.join(ctx.reactNativePath, 'jest/hasteImpl');
return {
resolver: {
resolverMainFields: ['react-native', 'browser', 'main'],
blacklistRE: getBlacklistRE(),
platforms: [...ctx.haste.platforms, 'native'],
providesModuleNodeModules: ctx.haste.providesModuleNodeModules,
hasteImplModulePath: path.join(ctx.reactNativePath, 'jest/hasteImpl'),
hasteImplModulePath: existsSync(hasteImplPath)
? hasteImplPath
: undefined,
},
serializer: {
getModulesRunBeforeMainModule: () => [
Expand Down