Skip to content

Commit e1ad744

Browse files
authored
fix(apple): fix "ReactTestApp-Resources spec is empty" error (#1232)
1 parent c7a4696 commit e1ad744

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

ios/test_app.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,9 @@ def resources_pod(project_root, target_platform, platforms)
159159

160160
app_dir = File.dirname(app_manifest)
161161
resources = resolve_resources(app_manifest(project_root), target_platform)
162+
return if resources.nil? || resources.empty?
162163

163-
if !resources.nil? && resources.any? { |r| !File.exist?(File.join(app_dir, r)) }
164+
if resources.any? { |r| !File.exist?(File.join(app_dir, r)) }
164165
Pod::UI.notice(
165166
'One or more resources were not found and will not be included in the project. ' \
166167
'If they are found later and you want to include them, run `pod install` again.'

test/test_test_app.rb

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,16 @@ def test_react_native_pods
150150
with_resources
151151
with_platform_resources
152152
].each do |fixture|
153-
assert_equal('.', resources_pod(fixture_path(fixture), target, platforms))
154-
assert_equal('..', resources_pod(fixture_path(fixture, target.to_s), target, platforms))
153+
podspec_path = resources_pod(fixture_path(fixture), target, platforms)
154+
inner_podspec_path = resources_pod(fixture_path(fixture, target.to_s), target, platforms)
155+
156+
if fixture.to_s.include?('without')
157+
assert_nil(podspec_path)
158+
assert_nil(inner_podspec_path)
159+
else
160+
assert_equal('.', podspec_path)
161+
assert_equal('..', inner_podspec_path)
162+
end
155163
end
156164
end
157165

@@ -176,12 +184,16 @@ def test_react_native_pods
176184
fixture_path('without_resources', target.to_s),
177185
].each do |project_root|
178186
podspec_path = resources_pod(project_root, target, platforms)
187+
188+
if project_root.to_s.include?('without')
189+
assert_nil(podspec_path)
190+
next
191+
end
192+
179193
manifest_path = app_manifest_path(project_root, podspec_path)
180194
manifest = JSON.parse(File.read(manifest_path))
181195

182-
if project_root.to_s.include?('without')
183-
assert_empty(manifest['resources'])
184-
elsif project_root.to_s.include?('with_platform_resources')
196+
if project_root.to_s.include?('with_platform_resources')
185197
assert_equal(platform_resources, manifest['resources'].sort)
186198
else
187199
assert_equal(resources, manifest['resources'].sort)

0 commit comments

Comments
 (0)