Skip to content

Commit

Permalink
Run script phases tests in CI and Sandcastle (#33802)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #33802

We use to have a couple of tests for the script phases script that were not running during the CI.

This diff connect them with the two CI, so that they run together with the other ruby tests.

## Changelog
[iOS][Added] - Run script phases tests in CI

Reviewed By: fkgozali

Differential Revision: D36283211

fbshipit-source-id: 01b257cdc99b0bc196d60d49ac76cf044d61a7e9
  • Loading branch information
Riccardo Cipolleschi authored and facebook-github-bot committed May 11, 2022
1 parent 7dc0b51 commit c171a6e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,8 @@ jobs:
- run:
name: Run Ruby Tests
command: |
cd scripts/cocoapods
sh run_tests.sh
cd scripts
sh run_ruby_tests.sh
- run_yarn
- run: |
cd packages/rn-tester
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@

require_relative "../script_phases"
require_relative "./script_phases.snap"
require 'minitest/autorun'
require "test/unit"

class TestScriptPhases < Minitest::Test
class TestScriptPhases < Test::Unit::TestCase

def test_get_script_phases_with_codegen_discovery_with_config_file_dir
result = get_script_phases_with_codegen_discovery(
react_native_path: '../..',
relative_app_root: '',
relative_config_file_dir: 'node_modules',
fabric_enabled: true)
assert_equal snap_get_script_phases_with_codegen_discovery_with_config_file_dir, result
assert_equal(snap_get_script_phases_with_codegen_discovery_with_config_file_dir, result)
end

def test_get_script_phases_with_codegen_discovery_without_config_file_dir
Expand All @@ -24,7 +24,7 @@ def test_get_script_phases_with_codegen_discovery_without_config_file_dir
relative_app_root: '',
relative_config_file_dir: '',
fabric_enabled: true)
assert_equal snap_get_script_phases_with_codegen_discovery_without_config_file_dir, result
assert_equal(snap_get_script_phases_with_codegen_discovery_without_config_file_dir, result)
end

def test_get_script_phases_no_codegen_discovery()
Expand All @@ -39,7 +39,7 @@ def test_get_script_phases_no_codegen_discovery()
js_srcs_dir: './',
file_list: '[".//NativeScreenshotManager.js"]'
)
assert_equal snap_get_script_phases_no_codegen_discovery, result
assert_equal(snap_get_script_phases_no_codegen_discovery, result)
end

end
15 changes: 9 additions & 6 deletions scripts/react_native_pods_utils/__tests__/script_phases.snap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ def snap_get_script_phases_with_codegen_discovery_with_config_file_dir()
export RCT_SCRIPT_FABRIC_ENABLED=true
export RCT_SCRIPT_TYPE=withCodegenDiscovery
SCRIPT_PHASES_SCRIPT=\"$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh\"
/bin/sh -c \"$SCRIPT_PHASES_SCRIPT\"
SCRIPT_PHASES_SCRIPT="$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh"
WITH_ENVIRONMENT="$RCT_SCRIPT_RN_DIR/scripts/xcode/with-environment.sh"
/bin/sh -c "$WITH_ENVIRONMENT $SCRIPT_PHASES_SCRIPT"
EOS
end

Expand All @@ -34,8 +35,9 @@ def snap_get_script_phases_with_codegen_discovery_without_config_file_dir()
export RCT_SCRIPT_FABRIC_ENABLED=true
export RCT_SCRIPT_TYPE=withCodegenDiscovery
SCRIPT_PHASES_SCRIPT=\"$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh\"
/bin/sh -c \"$SCRIPT_PHASES_SCRIPT\"
SCRIPT_PHASES_SCRIPT="$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh"
WITH_ENVIRONMENT="$RCT_SCRIPT_RN_DIR/scripts/xcode/with-environment.sh"
/bin/sh -c "$WITH_ENVIRONMENT $SCRIPT_PHASES_SCRIPT"
EOS
end

Expand All @@ -55,7 +57,8 @@ def snap_get_script_phases_no_codegen_discovery()
export RCT_SCRIPT_CODEGEN_COMPONENT_DIR=react/renderer/components
export RCT_SCRIPT_FILE_LIST=\"[\\\".//NativeScreenshotManager.js\\\"]\"
SCRIPT_PHASES_SCRIPT=\"$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh\"
/bin/sh -c \"$SCRIPT_PHASES_SCRIPT\"
SCRIPT_PHASES_SCRIPT="$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh"
WITH_ENVIRONMENT="$RCT_SCRIPT_RN_DIR/scripts/xcode/with-environment.sh"
/bin/sh -c "$WITH_ENVIRONMENT $SCRIPT_PHASES_SCRIPT"
EOS
end
2 changes: 2 additions & 0 deletions scripts/cocoapods/run_tests.sh → scripts/run_ruby_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
set -f

basepath=$(dirname "${0}")

# shellcheck disable=SC2207
files=( $(find . -name '*-test.rb') )

test_suite="${basepath}/all_tests.rb"
Expand Down

0 comments on commit c171a6e

Please sign in to comment.