Skip to content

feat(runtime): track promises and report test timeouts#138

Merged
V3RON merged 11 commits into
mainfrom
feat/promise-tracking
Jun 3, 2026
Merged

feat(runtime): track promises and report test timeouts#138
V3RON merged 11 commits into
mainfrom
feat/promise-tracking

Conversation

@V3RON
Copy link
Copy Markdown
Contributor

@V3RON V3RON commented Jun 2, 2026

What is this?

This PR improves how React Native Harness handles stalled async work in runtime tests. Instead of letting a long-running runTests bridge RPC time out and fail the whole file generically, Harness now reports the exact test case that timed out and tracks pending promises with their creation context.

How does it work?

The bridge no longer applies the generic RPC timeout to runTests; after the app connects, connection health is determined by heartbeat traffic. Jest passes the configured test timeout into the runtime, where each active test case is wrapped with a runtime timeout. When a test case times out, Harness emits a failed result for that case, synthesizes skipped results for the rest of the file, and restarts the app so leaked async work does not carry into later files or watch-mode runs.

The runtime also installs a Promise tracker that records pending promises, stack traces, and active test context while avoiding Harness's own timeout bookkeeping promises.

Why is this useful?

Reviewers and users can distinguish a healthy-but-stuck test case from a broken bridge or crashed runtime. Timeout reports now point at the specific test that stalled, remaining tests in the file are not run in a contaminated environment, and pending promise metadata gives a concrete starting point for diagnosing unresolved async work.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-native-harness Ready Ready Preview, Comment Jun 3, 2026 7:20am

Request Review

Add release planning notes for runtime test timeout reporting in PR 138.
Remove historical behavior framing from bridgeTimeout documentation.
Extend runtime timeout reporting to beforeAll and afterAll hooks, surface suite-level timeout errors in Jest results, and restart the app after any runtime timeout.
Add a Harness-level testTimeout config value and use it as the runtime timeout fallback when Jest does not provide one. Document the option and cover the precedence behavior in Jest package tests.
Use Harness config testTimeout ahead of Jest timeout settings and update docs/tests to describe the precedence.
Propagate promise tracker test context through promise chains and omit Harness wrapper promises from timeout diagnostics.
Skip teardown and final assertion flushing when timed-out test work resumes after the timeout result has already been reported.
@V3RON V3RON merged commit b7e9b58 into main Jun 3, 2026
6 checks passed
@V3RON V3RON deleted the feat/promise-tracking branch June 3, 2026 07:30
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