The `window-resizeto` package provides a polyfill and ponyfill for the `window.resizeTo` method, specifically designed for JavaScript test environments such as Jest and JSDOM. It addresses the common limitation in these environments where `window.resizeTo` is not natively implemented, leading to failures in tests that depend on window resizing functionality. The current stable version is 0.0.2, indicating it's still in early development, though seemingly stable for its intended purpose. Its release cadence appears infrequent, driven by specific fixes or minor enhancements. Key differentiators include its small footprint (under 10 lines of code) and its dual approach, offering both a global polyfill (`window-resizeto/polyfill`) and an explicit ponyfill function (`resizeTo`) for greater control. It effectively simulates window resizing by manipulating `outerWidth`, `outerHeight`, `innerWidth`, and `innerHeight` properties and dispatching a `resize` event, making it a drop-in solution for testing responsive UIs or logic tied to window dimensions without needing a full browser environment.
npm install window-resizetoVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to integrate `window-resizeto` with Jest by adding the polyfill to `setupFilesAfterEnv`, enabling `window.resizeTo` in tests to simulate different screen sizes and test responsive UI logic.
Ensure all imports, package.json dependencies, and file paths use the exact lowercase package name `window-resizeto`. Update any references with incorrect casing.
For Jest, add `'window-resizeto/polyfill'` to the `setupFilesAfterEnv` array in your `jest.config.js`. For standalone usage, ensure `import 'window-resizeto/polyfill'` is at the top of your test file or setup script before `window.resizeTo` is called.
Correct the import path to `window-resizeto/polyfill` (ensure 'resizeto' is entirely lowercase).
No dependency data recorded yet.