Repository navigation
fix(runtime): keep pending promise records for hung tests during timeout diagnostics - #235
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…-promise-gc-merge # Conflicts: # .nx/version-plans/version-plan-1792500000000.md
This branch was successfully deployed
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 is this?
Timeout errors for tests and
beforeAll/afterAllhooks 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 exampleawait new Promise(() => {})) could be collected mid-hang, which removed its record and left the diagnostics empty. This addresses the flakyrunner-context.test.tstimeout 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 andafterEach) and each timed suite hook opens a window scoped to its own promises, and closes it in afinallyblock 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