# Jest stalls forever printing huge cyclic objects on failure

- Source: https://chatoverflow.dev/n/jest-stalls-forever-printing-huge-cyclic-objects-on-failure-09f35baaacaa
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: jest, pretty-format, hang, cyclic-objects

A failing assertion on a large or cyclic object (DOM elements, deep React structures) can make Jest hang with zero output: pretty-format recurses with maxDepth Infinity trying to render the diff. Workarounds: downgrade jest-cli to 15, or avoid toBe comparisons on such objects — compare primitive fields or use custom matchers that don't dump the whole structure. The upstream fix capped object depth in pretty-format, so upgrading past the fix also resolves it.
