File tree Expand file tree Collapse file tree 6 files changed +20
-20
lines changed
private/react-native-fantom Expand file tree Collapse file tree 6 files changed +20
-20
lines changed Original file line number Diff line number Diff line change @@ -29,12 +29,7 @@ module.exports = {
2929 ] /*:: as ReadonlyArray<string> */ ,
3030 // This allows running Meta-internal tests with the `-test.fb.js` suffix.
3131 testRegex : '/__tests__/.*-itest(\\.fb)?\\.js$' ,
32- testPathIgnorePatterns : [
33- ...baseConfig . testPathIgnorePatterns ,
34- ...( process . env . FANTOM_INCLUDE_BENCHMARKS != null
35- ? [ ]
36- : [ 'benchmark-itest' ] ) ,
37- ] /*:: as ReadonlyArray<string> */ ,
32+ testPathIgnorePatterns : baseConfig . testPathIgnorePatterns ,
3833 transformIgnorePatterns : [ '.*' ] ,
3934 testRunner : '<rootDir>/private/react-native-fantom/runner/index.js' ,
4035 watchPathIgnorePatterns : [ '<rootDir>/private/react-native-fantom/build/' ] ,
Original file line number Diff line number Diff line change @@ -15,8 +15,7 @@ const VALID_ENVIRONMENT_VARIABLES = [
1515 'FANTOM_ENABLE_CPP_DEBUGGING' ,
1616 'FANTOM_FORCE_CI_MODE' ,
1717 'FANTOM_FORCE_OSS_BUILD' ,
18- 'FANTOM_FORCE_TEST_MODE' ,
19- 'FANTOM_INCLUDE_BENCHMARKS' ,
18+ 'FANTOM_RUN_BENCHMARKS' ,
2019 'FANTOM_LOG_COMMANDS' ,
2120 'FANTOM_PRINT_OUTPUT' ,
2221 'FANTOM_DEBUG_JS' ,
@@ -60,11 +59,12 @@ export const isCI: boolean =
6059 Boolean ( process . env . GITHUB_ACTIONS ) ;
6160
6261/**
63- * Forces benchmarks to run in test mode (running a single time to ensure
64- * correctness instead of multiples times to measure performance).
62+ * Runs benchmarks in benchmark mode (measuring performance with multiple
63+ * iterations). When false, benchmarks run in test mode (single iteration
64+ * for correctness only).
6565 */
66- export const forceTestModeForBenchmarks : boolean = Boolean (
67- process . env . FANTOM_FORCE_TEST_MODE ,
66+ export const runBenchmarks : boolean = Boolean (
67+ process . env . FANTOM_RUN_BENCHMARKS ,
6868) ;
6969
7070export const debugJS : boolean = Boolean ( process . env . FANTOM_DEBUG_JS ) ;
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ module.exports = function entrypointTemplate({
3737 const constants : FantomRuntimeConstants = {
3838 isOSS : EnvironmentOptions . isOSS ,
3939 isRunningFromCI : EnvironmentOptions . isCI ,
40- forceTestModeForBenchmarks : EnvironmentOptions . forceTestModeForBenchmarks ,
40+ runBenchmarks : EnvironmentOptions . runBenchmarks ,
4141 fantomConfigSummary : formatFantomConfig ( testConfig ) ,
4242 jsTraceOutputPath,
4343 jsHeapSnapshotOutputPathTemplate,
Original file line number Diff line number Diff line change @@ -113,15 +113,15 @@ export function suite(
113113 throw new Error ( 'No benchmark tests defined' ) ;
114114 }
115115
116- const { isRunningFromCI, forceTestModeForBenchmarks } = getConstants ( ) ;
116+ const { isRunningFromCI, runBenchmarks } = getConstants ( ) ;
117117
118118 // If we're running from CI and there's no verification function, there's
119119 // no point in running the benchmark.
120120 // We still run a single iteration of each test just to make sure that the
121121 // logic in the benchmark doesn't break.
122122 const isTestOnly =
123123 suiteOptions . testOnly === true ||
124- forceTestModeForBenchmarks ||
124+ ! runBenchmarks ||
125125 ( isRunningFromCI && verifyFns . length === 0 ) ;
126126
127127 const benchOptions : BenchOptions = isTestOnly
@@ -180,7 +180,11 @@ export function suite(
180180 bench . add ( task . name , task . fn , options ) ;
181181 }
182182
183- if ( ! isTestOnly ) {
183+ if ( isTestOnly ) {
184+ console . log (
185+ `Running benchmark in test mode: ${ suiteName } . Use --benchmarks to run in benchmark mode.` ,
186+ ) ;
187+ } else {
184188 console . log ( `Running benchmark: ${ suiteName } . Please wait.` ) ;
185189 }
186190
Original file line number Diff line number Diff line change 1111export type FantomRuntimeConstants = Readonly < {
1212 isOSS : boolean ,
1313 isRunningFromCI : boolean ,
14- forceTestModeForBenchmarks : boolean ,
14+ runBenchmarks : boolean ,
1515 fantomConfigSummary : string ,
1616 jsHeapSnapshotOutputPathTemplate : string ,
1717 jsHeapSnapshotOutputPathTemplateToken : string ,
@@ -21,7 +21,7 @@ export type FantomRuntimeConstants = Readonly<{
2121let constants : FantomRuntimeConstants = {
2222 isOSS : false ,
2323 isRunningFromCI : false ,
24- forceTestModeForBenchmarks : false ,
24+ runBenchmarks : false ,
2525 fantomConfigSummary : '' ,
2626 jsHeapSnapshotOutputPathTemplate : '' ,
2727 jsHeapSnapshotOutputPathTemplateToken : '' ,
Original file line number Diff line number Diff line change @@ -29,9 +29,10 @@ for arg in "$@"; do
2929 fi
3030done
3131
32- # When --benchmarks is passed, set env var so jest.config.js includes benchmark tests
32+ # When --benchmarks is passed, run benchmarks in benchmark mode.
33+ # Otherwise, run them in test mode (single iteration for correctness only).
3334if [[ " $INCLUDE_BENCHMARKS " == true ]]; then
34- FANTOM_INCLUDE_BENCHMARKS =1 yarn jest --config private/react-native-fantom/config/jest.config.js " ${ARGS[@]} "
35+ FANTOM_RUN_BENCHMARKS =1 yarn jest --config private/react-native-fantom/config/jest.config.js " ${ARGS[@]} "
3536else
3637 yarn jest --config private/react-native-fantom/config/jest.config.js " ${ARGS[@]} "
3738fi
You can’t perform that action at this time.
0 commit comments