Repository navigation
test(ios): run the RN library XCTest suites, not just the placeholder - #890
Merged
Merged
Conversation
The EnrichedMarkdownExampleTests target introduced in #877 only searched core/cpp/*, ios/internals and ios/input/internals. Any real suite importing library headers by relative path fails to build, because those headers import their siblings unqualified: ENRMLinkPillAttachment.h imports "ENRMUIKit.h", which lives in ios/utils and was unreachable. The placeholder smoke test imports nothing from the library, so the lane was green without ever proving a header could be resolved. vendor/ and generated/ stay out: sweeping vendor in pulls three RaTeX xcframework module maps into scope and clang rejects the duplicate RaTeXFFI module definitions. Created with usage of AI tools
EnrichedMarkdownExample.xcodeproj is objectVersion 54 and lists sources explicitly, so nothing under __tests__/ios is discovered automatically. #877 said the real suites "plug into the same target on merge"; that holds for Android, where Gradle auto-discovers src/test/java, but on iOS each file needs a PBXFileReference, a PBXBuildFile, a group entry and a Sources phase entry. Adds ENRMLinkPillTextStorageTests.mm from #862. With this plus the header search paths, the lane runs 13 tests instead of the placeholder alone. This branch is red until #862 merges: the .mm it references does not exist on main yet. It also needs the one-line NULL -> nullptr fix on #862 itself (ENRMLinkPillTextStorageTests.mm:254) -- XCTAssertNotEqual(bitmap, NULL) compares CGContextRef against __null, which is a hard error in ObjC++. Created with usage of AI tools
2 of 6 tasks
Replaces the per-file pbxproj registration added in the previous commit. EnrichedMarkdownExample.xcodeproj is objectVersion 54 and lists sources explicitly, so every new __tests__/ios file needed four pbxproj entries, and a file nobody wired stayed silently unrun - which is how the lane passed while covering nothing. A "Generate library test sources" phase on the test target now globs __tests__/ios and emits an include list that one wired umbrella source, ENRMLibraryTests.mm, pulls in. Adding a test file there needs no project change, matching what Gradle already does for src/test/java on Android. test-ios.sh additionally counts the "- (void)test" prototypes present and fails when fewer tests than that ran, so a suite dropping out of the run cannot leave the lane green. Created with usage of AI tools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What/Why?
Follow-up to #877.
#877 wired the
rn-ios-unit-testslane and said #862's real suites "plug into the same target on merge". That holds on Android - Gradle auto-discoverssrc/test/java, soLinkPillSpanTestruns with zero wiring the moment #862 lands. It did not hold on iOS, for three reasons this PR fixes.1. Sources were not auto-discovered.
EnrichedMarkdownExample.xcodeprojis objectVersion 54 and lists every source explicitly, so each__tests__/ios/*.mmneeded aPBXFileReference, aPBXBuildFile, a group entry and a Sources-phase entry. A file nobody wired stayed silently unrun rather than failing, which is how the lane passed while covering nothing.The test target now has a
Generate library test sourcesbuild phase runningscripts/generate-ios-test-sources.sh, which globs__tests__/iosand emits an include list that one wired umbrella source,EnrichedMarkdownExampleTests/ENRMLibraryTests.mm, pulls in. Dropping a.m/.mmin that directory is now the whole procedure, matching Android.The tradeoff: every file there compiles into one translation unit, so file-scope helpers share a namespace and need distinct names. The
ENRMprefix already does this for classes. Documented in the script header and the directory README.2. The test target could not resolve library headers.
HEADER_SEARCH_PATHScoveredcore/cpp/*,ios/internalsandios/input/internalsonly. Library headers import their siblings unqualified -ENRMLinkPillAttachment.hdoes#import "ENRMUIKit.h", which lives inios/utilsand was unreachable. Any real suite failed to build on the first import. This went unnoticed becauseEnrichedMarkdownExampleTests.mimports nothing from the library, so the lane was green without ever proving a single library header could be resolved.vendor/andgenerated/are deliberately excluded - sweepingvendorin pulls three RaTeX xcframework module maps into scope and clang rejects the duplicateRaTeXFFImodule definitions.3. A green
test:iosproved nothing about how much ran.scripts/test-ios.shnow counts the- (void)testprototypes under__tests__/iosand fails when fewer tests than that actually ran. It is an under-approximation by design (helper superclasses can add tests), so it catches a suite dropping out of the run without going stale as suites grow.On
-quietWorth recording, because the previous comment in
test-ios.shasserted the opposite. Measured on Xcode 27 by breakingtestHarnessRunson purpose:-quietSo a red lane named the failing test and said nothing about why. Dropping
-quietwould fix that by adding thousands of pod compile lines to every CI log, so instead the run asks for a-resultBundlePathand reads both the count and the failure text back out of it:When the build fails before any test runs the bundle is absent, the report is skipped, and
xcodebuildhas already said why.Testing
Verified locally on Xcode 27 with a full
yarn prepare+pod installper configuration:Executed 1 test(s), exit 0. The generated include list is empty and the umbrella compiles to nothing.ENRMLinkPillTextStorageTests.mm:255. See below.Executed 14 test(s), exit 0 - feat: add opt-in native link pill presentation #862's 13 tests plustestHarnessRuns, discovered and run with no project change.testHarnessRunsbroken deliberately, confirmed the assertion text above reaches the log and the lane exits non-zero.Not yet verified: CI pins Xcode 26.3 and these runs were on 27.
xcresulttool get test-results summaryexists on both, but the lane has not been observed green on 26.3 - that is what the checks on this PR will establish.#862 needs a one-line fix of its own
ENRMLinkPillTextStorageTests.mm:255:In Objective-C++
NULLis__null(along), so the macro expands to a pointer/integer comparison - a hard error, not a warning. Already raised on #862.This PR does not fix it and cannot - the file does not exist on this branch. What it changes is that the error is now enforced instead of ignored: before, #862 could merge with a broken test file and nothing would notice, because the suite was never compiled. Once this lands, #862's own CI goes red until the line is fixed.
Created with usage of AI tools