{"library":"mock-match-media","type":"library","category":null,"description":"mock-match-media is a ponyfill for `window.matchMedia` designed for testing environments and server-side rendering (SSR) in Node.js. It allows developers to simulate various CSS media queries, including advanced Media Queries Level 5 features like range syntax (e.g., `(width < 150px)`), without a browser DOM. The current stable version is `1.0.3`, with releases focused on bug fixes and spec compliance. Key differentiators include its full compliance with the W3C Media Queries Level 5 specification, comprehensive support for event listeners (`addEventListener`, `removeEventListener`, `onchange`, `dispatchEvent`), and utility functions for cleaning up test states. It is written in TypeScript and primarily targets Node.js environments, requiring at least Node v20.19.0 for full ESM compatibility. The library offers both direct import and a polyfill mechanism.","language":"javascript","status":"active","version":"1.0.3","tags":["javascript","match-media","mock","test","jest","ssr","server-side-rendering","typescript"],"install":[{"cmd":"npm install mock-match-media","imports":["import { matchMedia, setMedia, cleanup } from 'mock-match-media';","import { MediaQueryListEvent } from 'mock-match-media';","import 'mock-match-media/polyfill';"]},{"cmd":"yarn add mock-match-media","imports":[]},{"cmd":"pnpm add mock-match-media","imports":[]}],"homepage":null,"github":"https://github.com/Ayc0/mock-match-media","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/mock-match-media","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":{"summary":{"python_range":"18–22","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"url":"https://checklist.day/v1/registry/mock-match-media/compatibility"},"provenance":{"verified_status":null,"verified_at":null,"last_verified":"Wed Jun 17","next_check":"Sat Jul 18","install_tag":null}}