diff --git a/private/react-native-fantom/config/jest.config.js b/private/react-native-fantom/config/jest.config.js index adf10408e5c2..34efa5467e77 100644 --- a/private/react-native-fantom/config/jest.config.js +++ b/private/react-native-fantom/config/jest.config.js @@ -29,7 +29,12 @@ module.exports = { ] /*:: as $ReadOnlyArray */, // This allows running Meta-internal tests with the `-test.fb.js` suffix. testRegex: '/__tests__/.*-itest(\\.fb)?\\.js$', - testPathIgnorePatterns: baseConfig.testPathIgnorePatterns, + testPathIgnorePatterns: [ + ...baseConfig.testPathIgnorePatterns, + ...(process.env.FANTOM_INCLUDE_BENCHMARKS != null + ? [] + : ['benchmark-itest']), + ] /*:: as ReadonlyArray */, transformIgnorePatterns: ['.*'], testRunner: '/private/react-native-fantom/runner/index.js', watchPathIgnorePatterns: ['/private/react-native-fantom/build/'], diff --git a/private/react-native-fantom/runner/EnvironmentOptions.js b/private/react-native-fantom/runner/EnvironmentOptions.js index 553049aacaa8..74e012691907 100644 --- a/private/react-native-fantom/runner/EnvironmentOptions.js +++ b/private/react-native-fantom/runner/EnvironmentOptions.js @@ -16,6 +16,7 @@ const VALID_ENVIRONMENT_VARIABLES = [ 'FANTOM_FORCE_CI_MODE', 'FANTOM_FORCE_OSS_BUILD', 'FANTOM_FORCE_TEST_MODE', + 'FANTOM_INCLUDE_BENCHMARKS', 'FANTOM_LOG_COMMANDS', 'FANTOM_PRINT_OUTPUT', 'FANTOM_DEBUG_JS', diff --git a/scripts/fantom.sh b/scripts/fantom.sh index 9ae47c1f23b6..5a08cbf67e10 100755 --- a/scripts/fantom.sh +++ b/scripts/fantom.sh @@ -16,4 +16,20 @@ fi export NODE_OPTIONS='--max-old-space-size=8192' -yarn jest --config private/react-native-fantom/config/jest.config.js "$@" +# Parse arguments to check for --benchmarks flag +INCLUDE_BENCHMARKS=false +ARGS=() +for arg in "$@"; do + if [[ "$arg" == "--benchmarks" ]]; then + INCLUDE_BENCHMARKS=true + else + ARGS+=("$arg") + fi +done + +# When --benchmarks is passed, set env var so jest.config.js includes benchmark tests +if [[ "$INCLUDE_BENCHMARKS" == true ]]; then + FANTOM_INCLUDE_BENCHMARKS=1 yarn jest --config private/react-native-fantom/config/jest.config.js "${ARGS[@]}" +else + yarn jest --config private/react-native-fantom/config/jest.config.js "${ARGS[@]}" +fi