Skip to content

fix: Make runtime tests pass in the whole Debug/Release × BundleMode/LegacyEval matrix#9931

Open
tjzel wants to merge 2 commits into
@tjzel/runtime-tests-clifrom
@tjzel/runtime-tests-fixes
Open

fix: Make runtime tests pass in the whole Debug/Release × BundleMode/LegacyEval matrix#9931
tjzel wants to merge 2 commits into
@tjzel/runtime-tests-clifrom
@tjzel/runtime-tests-fixes

Conversation

@tjzel

@tjzel tjzel commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Note

This PR description was AI-generated.

Stacked on #9930. Part 5 of the runtime-tests spec.

Summary

I made the runtime tests run and pass in all four configurations — Debug and Release builds, each in Bundle Mode and Legacy Eval Mode — and fixed every failing test found along the way. Note that apps/fabric-example ships with Bundle Mode on by default; yarn toggle-bundle-mode switches to Legacy Eval Mode.

Release configuration. I added a ReleaseRuntimeTests build configuration (via the Xcodeproj API — hand-edited pbxproj blocks get dropped when pod install re-serializes the project). The React Native bundle phase now embeds two Hermes bundles for *RuntimeTests configurations — main.runtimeTests.reanimated.jsbundle and main.runtimeTests.worklets.jsbundle (one react-native-xcode.sh invocation per entry with ENTRY_FILE/BUNDLE_NAME) — and the AppDelegate loads the right one from the RUNTIME_TESTS_LIBRARY launch environment variable. The server skips Metro entirely for Release configurations (--configuration ReleaseRuntimeTests) and listens on 8082, matching the app's no-Metro WebSocket fallback.

Bundle/Legacy matrix support. The server-spawned Metro now always starts with --reset-cache — a cache produced under the other Bundle Mode setting serves stale module maps ("Requiring unknown module"). The bundle mode core suite was silently never running: its disabled flag read globalThis._WORKLETS_BUNDLE_MODE_ENABLED at module scope, which races module initialization under inline requires — it now calls isBundleModeEnabled(), which forces react-native-worklets to initialize first. I also added --include <suites> to the server/runner protocol so CI can opt skipByDefault suites (like bundle mode core) into a run.

Test fixes (all previously failing or mode-dependent):

  • toThrow now captures the ErrorUtils global handler for the duration of the asserted function (with a bounded grace period), so errors that Worklets reports asynchronously via reportFatalError — the runOnUISync path — are seen by the matcher regardless of which handler (LogBox, remote reporter) is installed around the run. This fixes throws when trying to serialize a Promise.
  • createSerializableHostObject and the isSerializableRef host-object test used globalThis.__reanimatedModuleProxy as their host-object specimen — a hidden Reanimated dependency in Worklets tests, exposed by the isolation work in feat: CLI runner for runtime tests, one library at a time #9930. They now use __workletsModuleProxy.
  • createSerializableOnUIInaccessibleObject: in Debug the unsupported value comes back as a placeholder that throws on access; in Release runOnUISync throws synchronously during copy-back. The runOnUISync call now lives inside the asserted function so both channels land in the matcher.
  • The two Promise-serialization tests asserted mode-specific error-message variants that swap between Bundle and Legacy modes; they now assert the stable part ('Promise').
  • The COLOR comparator briefly regressed to React Native's processColor (no hwb() support) in feat: CLI runner for runtime tests, one library at a time #9930's color-utils split; it now lazy-requires Reanimated's isColor/processColor (color comparisons only happen in Reanimated tests, so Worklets isolation is preserved). Formatting-only helpers keep the RN-based implementation.
  • formatTestName now replaces every occurrence of a placeholder, fixing test names like … → ${finalColor}.

Test plan

Full matrix on iPhone 17 Pro simulator via yarn runtime-tests:

Configuration Reanimated Worklets
Debug + Bundle Mode 212 passed, 0 failed 1350 passed, 0 failed (+ bundle mode core via --include: 8 passed, 0 failed)
Debug + Legacy Eval 225 passed, 0 failed 1338 passed, 0 failed
Release + Bundle Mode 212 passed, 0 failed 1294 passed, 1 failed → the failure was createSerializableOnUIInaccessibleObject, fixed above
Release + Legacy Eval 225 passed, 0 failed 1260 passed, 0 failed (validates the InaccessibleObject fix in Release)

Counts differ across cells because __DEV__-guarded suites are excluded in Release and !bundleMode-gated plugin tests only run in Legacy mode. yarn type:check:native in apps/common-app passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant