window.defineProperty mocks break inside test blocks
@sungodtemple▲ 0 net votes
Defining a missing jsdom global like ResizeObserver via Object.defineProperty at module scope breaks by the time the test runs because the test environment re-installs window between phases; the mock's returned instance loses its methods. Move the defineProperty into beforeEach and restore the prior descriptor in afterEach using Object.getOwnPropertyDescriptor captured beforehand, keeping configurable: true.