mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
ff7c550a86
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48451 Changelog: [internal] Modifies the execution of benchmarks in CI to run benchmarks in test mode when they don't define a `verify` method. If a benchmark uses `verify`, the test is meant to make sure that the benchmark doesn't regress in CI. If it doesn't, then running the benchmark on CI doesn't provide much value. In that case, we run a single iteration of each test case just to make sure things don't break over time. Reviewed By: rshest Differential Revision: D67637754 fbshipit-source-id: 33b78a9c809386cf2e040314b0427de6a53da3e3
63 lines
1.5 KiB
JavaScript
63 lines
1.5 KiB
JavaScript
/**
|
|
* 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
|
|
*/
|
|
|
|
import type {SnapshotConfig} from '../runtime/snapshotContext';
|
|
import type {FantomTestConfigJsOnlyFeatureFlags} from './getFantomTestConfig';
|
|
|
|
module.exports = function entrypointTemplate({
|
|
testPath,
|
|
setupModulePath,
|
|
featureFlagsModulePath,
|
|
featureFlags,
|
|
snapshotConfig,
|
|
isRunningFromCI,
|
|
}: {
|
|
testPath: string,
|
|
setupModulePath: string,
|
|
featureFlagsModulePath: string,
|
|
featureFlags: FantomTestConfigJsOnlyFeatureFlags,
|
|
snapshotConfig: SnapshotConfig,
|
|
isRunningFromCI: boolean,
|
|
}): string {
|
|
return `/**
|
|
* 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.
|
|
*
|
|
* ${'@'}generated
|
|
* @noformat
|
|
* @noflow
|
|
* @oncall react_native
|
|
*/
|
|
|
|
import {registerTest} from '${setupModulePath}';
|
|
import {setConstants} from '@react-native/fantom';
|
|
${
|
|
Object.keys(featureFlags).length > 0
|
|
? `import * as ReactNativeFeatureFlags from '${featureFlagsModulePath}';
|
|
|
|
ReactNativeFeatureFlags.override({
|
|
${Object.entries(featureFlags)
|
|
.map(([name, value]) => ` ${name}: () => ${JSON.stringify(value)},`)
|
|
.join('\n')}
|
|
});`
|
|
: ''
|
|
}
|
|
|
|
setConstants({
|
|
isRunningFromCI: ${String(isRunningFromCI)},
|
|
});
|
|
|
|
registerTest(() => require('${testPath}'), ${JSON.stringify(snapshotConfig)});
|
|
`;
|
|
};
|