Another reason to jest getting freeze with no apparent reason is adding a function as a dependency for a React useEffect hook, even if the linter encourages you to do so.
Because everything will work apparently fine: it builds, it runs, it works, and you can run the tests just for your component. Everything will be totally fine. BUT... you'll freeze the tests run just when you run all the test together. (Jest 29.7.0 and node 20.19.0)