Skip to content

Commit c171a6e

Browse files
Riccardo Cipolleschifacebook-github-bot
authored andcommitted
Run script phases tests in CI and Sandcastle (facebook#33802)
Summary: Pull Request resolved: facebook#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
1 parent 7dc0b51 commit c171a6e

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,8 @@ jobs:
455455
- run:
456456
name: Run Ruby Tests
457457
command: |
458-
cd scripts/cocoapods
459-
sh run_tests.sh
458+
cd scripts
459+
sh run_ruby_tests.sh
460460
- run_yarn
461461
- run: |
462462
cd packages/rn-tester

scripts/react_native_pods_utils/__tests__/script_phases.test.rb renamed to scripts/react_native_pods_utils/__tests__/script_phases-test.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55

66
require_relative "../script_phases"
77
require_relative "./script_phases.snap"
8-
require 'minitest/autorun'
8+
require "test/unit"
99

10-
class TestScriptPhases < Minitest::Test
10+
class TestScriptPhases < Test::Unit::TestCase
1111

1212
def test_get_script_phases_with_codegen_discovery_with_config_file_dir
1313
result = get_script_phases_with_codegen_discovery(
1414
react_native_path: '../..',
1515
relative_app_root: '',
1616
relative_config_file_dir: 'node_modules',
1717
fabric_enabled: true)
18-
assert_equal snap_get_script_phases_with_codegen_discovery_with_config_file_dir, result
18+
assert_equal(snap_get_script_phases_with_codegen_discovery_with_config_file_dir, result)
1919
end
2020

2121
def test_get_script_phases_with_codegen_discovery_without_config_file_dir
@@ -24,7 +24,7 @@ def test_get_script_phases_with_codegen_discovery_without_config_file_dir
2424
relative_app_root: '',
2525
relative_config_file_dir: '',
2626
fabric_enabled: true)
27-
assert_equal snap_get_script_phases_with_codegen_discovery_without_config_file_dir, result
27+
assert_equal(snap_get_script_phases_with_codegen_discovery_without_config_file_dir, result)
2828
end
2929

3030
def test_get_script_phases_no_codegen_discovery()
@@ -39,7 +39,7 @@ def test_get_script_phases_no_codegen_discovery()
3939
js_srcs_dir: './',
4040
file_list: '[".//NativeScreenshotManager.js"]'
4141
)
42-
assert_equal snap_get_script_phases_no_codegen_discovery, result
42+
assert_equal(snap_get_script_phases_no_codegen_discovery, result)
4343
end
4444

4545
end

scripts/react_native_pods_utils/__tests__/script_phases.snap.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ def snap_get_script_phases_with_codegen_discovery_with_config_file_dir()
1616
export RCT_SCRIPT_FABRIC_ENABLED=true
1717
export RCT_SCRIPT_TYPE=withCodegenDiscovery
1818
19-
SCRIPT_PHASES_SCRIPT=\"$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh\"
20-
/bin/sh -c \"$SCRIPT_PHASES_SCRIPT\"
19+
SCRIPT_PHASES_SCRIPT="$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh"
20+
WITH_ENVIRONMENT="$RCT_SCRIPT_RN_DIR/scripts/xcode/with-environment.sh"
21+
/bin/sh -c "$WITH_ENVIRONMENT $SCRIPT_PHASES_SCRIPT"
2122
EOS
2223
end
2324

@@ -34,8 +35,9 @@ def snap_get_script_phases_with_codegen_discovery_without_config_file_dir()
3435
export RCT_SCRIPT_FABRIC_ENABLED=true
3536
export RCT_SCRIPT_TYPE=withCodegenDiscovery
3637
37-
SCRIPT_PHASES_SCRIPT=\"$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh\"
38-
/bin/sh -c \"$SCRIPT_PHASES_SCRIPT\"
38+
SCRIPT_PHASES_SCRIPT="$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh"
39+
WITH_ENVIRONMENT="$RCT_SCRIPT_RN_DIR/scripts/xcode/with-environment.sh"
40+
/bin/sh -c "$WITH_ENVIRONMENT $SCRIPT_PHASES_SCRIPT"
3941
EOS
4042
end
4143

@@ -55,7 +57,8 @@ def snap_get_script_phases_no_codegen_discovery()
5557
export RCT_SCRIPT_CODEGEN_COMPONENT_DIR=react/renderer/components
5658
export RCT_SCRIPT_FILE_LIST=\"[\\\".//NativeScreenshotManager.js\\\"]\"
5759
58-
SCRIPT_PHASES_SCRIPT=\"$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh\"
59-
/bin/sh -c \"$SCRIPT_PHASES_SCRIPT\"
60+
SCRIPT_PHASES_SCRIPT="$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh"
61+
WITH_ENVIRONMENT="$RCT_SCRIPT_RN_DIR/scripts/xcode/with-environment.sh"
62+
/bin/sh -c "$WITH_ENVIRONMENT $SCRIPT_PHASES_SCRIPT"
6063
EOS
6164
end

scripts/cocoapods/run_tests.sh renamed to scripts/run_ruby_tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
set -f
88

99
basepath=$(dirname "${0}")
10+
11+
# shellcheck disable=SC2207
1012
files=( $(find . -name '*-test.rb') )
1113

1214
test_suite="${basepath}/all_tests.rb"

0 commit comments

Comments
 (0)