Skip to content

Commit 677330a

Browse files
sammy-SCmeta-codesync[bot]
authored andcommitted
Exclude benchmark tests by default, add --benchmarks flag (#55725)
Summary: Pull Request resolved: #55725 changelog: [internal] By default, `yarn fantom` now excludes benchmark tests (`*-benchmark-itest.js` files) to speed up regular test runs. Benchmark tests are typically slower and used for performance analysis rather than correctness testing. Excluding them by default improves the developer experience for everyday test runs. To run benchmark tests, use the new `--benchmarks` flag: ``` yarn fantom --benchmarks ``` Reviewed By: andrewdacenko Differential Revision: D92150163 fbshipit-source-id: 4c40ef1ba542c4856221373d8239ba603e8f6620
1 parent 63f1e29 commit 677330a

3 files changed

Lines changed: 24 additions & 2 deletions

File tree

private/react-native-fantom/config/jest.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ 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: baseConfig.testPathIgnorePatterns,
32+
testPathIgnorePatterns: [
33+
...baseConfig.testPathIgnorePatterns,
34+
...(process.env.FANTOM_INCLUDE_BENCHMARKS != null
35+
? []
36+
: ['benchmark-itest']),
37+
] /*:: as ReadonlyArray<string> */,
3338
transformIgnorePatterns: ['.*'],
3439
testRunner: '<rootDir>/private/react-native-fantom/runner/index.js',
3540
watchPathIgnorePatterns: ['<rootDir>/private/react-native-fantom/build/'],

private/react-native-fantom/runner/EnvironmentOptions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const VALID_ENVIRONMENT_VARIABLES = [
1616
'FANTOM_FORCE_CI_MODE',
1717
'FANTOM_FORCE_OSS_BUILD',
1818
'FANTOM_FORCE_TEST_MODE',
19+
'FANTOM_INCLUDE_BENCHMARKS',
1920
'FANTOM_LOG_COMMANDS',
2021
'FANTOM_PRINT_OUTPUT',
2122
'FANTOM_DEBUG_JS',

scripts/fantom.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,20 @@ fi
1616

1717
export NODE_OPTIONS='--max-old-space-size=8192'
1818

19-
yarn jest --config private/react-native-fantom/config/jest.config.js "$@"
19+
# Parse arguments to check for --benchmarks flag
20+
INCLUDE_BENCHMARKS=false
21+
ARGS=()
22+
for arg in "$@"; do
23+
if [[ "$arg" == "--benchmarks" ]]; then
24+
INCLUDE_BENCHMARKS=true
25+
else
26+
ARGS+=("$arg")
27+
fi
28+
done
29+
30+
# When --benchmarks is passed, set env var so jest.config.js includes benchmark tests
31+
if [[ "$INCLUDE_BENCHMARKS" == true ]]; then
32+
FANTOM_INCLUDE_BENCHMARKS=1 yarn jest --config private/react-native-fantom/config/jest.config.js "${ARGS[@]}"
33+
else
34+
yarn jest --config private/react-native-fantom/config/jest.config.js "${ARGS[@]}"
35+
fi

0 commit comments

Comments
 (0)