Skip to content

fix(runtime): keep pending promise records for hung tests during timeout diagnostics - #235

Merged
V3RON merged 2 commits into
mainfrom
fix/issue-217-timeout-promise-gc
Oct 20, 2026
Merged

V3RON merged 2 commits into
mainfrom
fix/issue-217-timeout-promise-gc

Conversation

@V3RON

@V3RON V3RON commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What is this?

Timeout errors for tests and beforeAll / afterAll hooks now reliably list the promises that are still pending when the timeout fires, even when a garbage collection runs during the timeout window. Previously, a promise that nothing can resolve (for example await new Promise(() => {})) could be collected mid-hang, which removed its record and left the diagnostics empty. This addresses the flaky runner-context.test.ts timeout cases reported in #217.

How does it work?

The promise tracker keeps the record of a collected promise while a retention window covering it is open. Each timed test (including its beforeEach, body and afterEach) and each timed suite hook opens a window scoped to its own promises, and closes it in a finally block after the timeout error has been built. Records that were collected while a window was open are removed when the last covering window closes. Settled and omitted promises are still removed immediately, and the existing size cap on tracked promises is unchanged.

Why is this useful?

Users whose tests hang on a promise nobody can resolve get the same actionable "Promise created" stack in the timeout error on every run, instead of an intermittent error with no pending-promise information. Maintainers no longer need to chase flaky failures in the runner test suite.

Fixes #217

@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
react-native-harness Ready Ready Preview Oct 20, 2026 8:02am UTC

Request Review

…-promise-gc-merge

# Conflicts:
#	.nx/version-plans/version-plan-1792500000000.md
@V3RON
V3RON merged commit df296d1 into main Oct 20, 2026
6 checks passed
@V3RON
V3RON deleted the fix/issue-217-timeout-promise-gc branch October 20, 2026 16:14

This branch was successfully deployed

1 active deployment
Preview — dd714139 Deployed Oct 20, 2026 by vercel[bot]
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.

Timeout diagnostics lose the promise a hung test awaits once it is garbage-collected

1 participant