Repository navigation
test: create react-native test harness - #877
Merged
Merged
Conversation
eszlamczyk
marked this pull request as ready for review
September 24, 2026 11:37
eszlamczyk
added a commit
that referenced
this pull request
Oct 9, 2026
…#890) * fix(test): give the RN iOS test target the library header search paths 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 * test(ios): register the link pill XCTest suite in the test target 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 * test(ios): auto-discover the library XCTest sources 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.
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 #862. The React Native package (
packages/react-native-enriched-markdown) had native unit-test sources but nothing ran them: the podspec has notest_spec, there was no iOS test target, and the RN Android tests were never picked up by the standalone@enriched-markdown/androidlane (flagged in the #862 review). This PR wires both platforms' library-level native unit tests into CI, mirroring how React Native itself runsRNTesterUnitTests(app-hosted XCTest).Harness-only for now, kept green with placeholder smoke tests. The real suites from #862 (
ENRMLinkPillTextStorageTests.mm,LinkPillSpanTest.kt) plug into the same target / source set when that PR merges (see__tests__/ios/README.md).iOS
EnrichedMarkdownExampleTestsXCTest target in the example app's Xcode project, reusing the canonical RN-template UUIDs the shared scheme already referenced but that had been stripped from the project.inherit! :complete, so tests link the same pods as the app (incl.ReactNativeEnrichedMarkdown) and run against the exact code the app ships.apps/react-native-example/scripts/test-ios.sh(resolvesIOS_SIMULATOR_UDID-> booted -> first available iPhone). A simulator is required because the tests exercise UIKit/TextKit; there is no iOS equivalent of Robolectric.SwiftLinker.swift(empty) makes the ObjC test bundle link the Swift runtime; without it CI's pinned Xcode fails at link withUndefined symbol __swift_FORCE_LOAD_$_swiftCompatibility56(the app + RaTeX math bridge are Swift).EnrichedMarkdownExampleTests.mis the placeholder smoke test.Android
junit+robolectricandtestOptions { unitTests.includeAndroidResources = true }to the RN module'sandroid/build.gradle.:react-native-enriched-markdown:testDebugUnitTest(pure JVM, no emulator) from the example app's Gradle project.HarnessSmokeTest.ktplaceholder keeps the task from tripping Gradle 9'sfailOnNoDiscoveredTests.Wiring
test:ios/test:androidon the example app.package.jsonshortcuts:test:ios,test:android,test:ios-native,test:android-native(mirrors the existingtest:e2e:*family). All four CI test lanes now invoke these shortcuts.rn-ios-unit-testsandrn-android-unit-tests, gated inci-success.Testing
yarn test:ios->** TEST SUCCEEDED **(app-hosted XCTest on a headless simulator).yarn test:android->BUILD SUCCESSFUL(testDebugUnitTest, Robolectric on the JVM).yarn test(Jest 44/44),yarn typecheck,yarn lintunaffected and green.rn-ios-unit-tests(swiftCompatibility56); this PR includes the fix (SwiftLinker.swift).Out of scope / follow-ups: #862's real suites attach to these targets on merge; parked review ideas - moving the example apps out of the repo, and removing the deprecated ENV / gradle-property config path before 1.1.