mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 21:27:46 +00:00
Use Meta-specific renderers when running tests in Meta infra (#47705)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47705 Changelog: [internal] Reviewed By: sammy-SC Differential Revision: D66094272 fbshipit-source-id: 25c0bc2d9e68ed1f4ede9dc5f0470a530b5db7d0
This commit is contained in:
parent
13bc4a2a43
commit
4da6ed5caf
30
jest/integration/config/hasteImpl.js
Normal file
30
jest/integration/config/hasteImpl.js
Normal file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const crypto = require('crypto');
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = {
|
||||
getHasteName(filePath) {
|
||||
if (filePath.endsWith('ReactNativeInternalFeatureFlags.js')) {
|
||||
return 'ReactNativeInternalFeatureFlags';
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
getCacheKey() {
|
||||
return crypto
|
||||
.createHash('sha1')
|
||||
.update(fs.readFileSync(__filename))
|
||||
.digest('hex');
|
||||
},
|
||||
};
|
@ -23,18 +23,27 @@ const config = {
|
||||
update: () => {},
|
||||
},
|
||||
resolver: {
|
||||
blockList: null,
|
||||
sourceExts: [...rnTesterConfig.resolver.sourceExts, 'fb.js'],
|
||||
blockList: /\/RendererProxy\.fb\.js$/, // Disable dependency injection for the renderer
|
||||
disableHierarchicalLookup: !!process.env.JS_DIR,
|
||||
sourceExts: ['fb.js', ...rnTesterConfig.resolver.sourceExts],
|
||||
nodeModulesPaths: process.env.JS_DIR
|
||||
? [path.join(process.env.JS_DIR, 'public', 'node_modules')]
|
||||
: [],
|
||||
hasteImplModulePath: path.resolve(__dirname, 'hasteImpl.js'),
|
||||
},
|
||||
transformer: {
|
||||
// We need to wrap the default transformer so we can run it from source
|
||||
// using babel-register.
|
||||
babelTransformerPath: path.resolve(__dirname, 'metro-babel-transformer.js'),
|
||||
},
|
||||
watchFolders: process.env.JS_DIR ? [process.env.JS_DIR] : [],
|
||||
watchFolders: process.env.JS_DIR
|
||||
? [
|
||||
path.join(process.env.JS_DIR, 'RKJSModules', 'vendor', 'react'),
|
||||
path.join(process.env.JS_DIR, 'tools', 'metro'),
|
||||
path.join(process.env.JS_DIR, 'node_modules'),
|
||||
path.join(process.env.JS_DIR, 'public', 'node_modules'),
|
||||
]
|
||||
: [],
|
||||
};
|
||||
|
||||
module.exports = mergeConfig(rnTesterConfig, config);
|
||||
|
@ -92,8 +92,8 @@ module.exports = async function runTest(
|
||||
const setupModulePath = path.resolve(__dirname, '../runtime/setup.js');
|
||||
|
||||
const entrypointContents = entrypointTemplate({
|
||||
testPath: `.${path.sep}${path.relative(BUILD_OUTPUT_PATH, testPath)}`,
|
||||
setupModulePath: `.${path.sep}${path.relative(BUILD_OUTPUT_PATH, setupModulePath)}`,
|
||||
testPath: `${path.relative(BUILD_OUTPUT_PATH, testPath)}`,
|
||||
setupModulePath: `${path.relative(BUILD_OUTPUT_PATH, setupModulePath)}`,
|
||||
});
|
||||
|
||||
const entrypointPath = path.join(
|
||||
|
@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
// Left intentionally empty. All flags are assumed to be false.
|
Loading…
Reference in New Issue
Block a user