{"library":"xhr-mocklet","type":"library","category":null,"description":"`xhr-mocklet` is a lightweight utility designed for intercepting and mocking `XMLHttpRequest` objects in both browser and Node.js environments, primarily for unit testing. Currently at version 1.2.3, it receives updates as needed, indicated by recent patch releases addressing bug fixes and minor feature additions. The library allows developers to define custom responses for specific HTTP methods and URLs, simulate network errors, and trigger timeouts, providing fine-grained control over network interactions during tests. A key differentiator is its simplicity and direct focus on `XMLHttpRequest` mocking, offering a clear API for setup, teardown, and request handling. It also provides comprehensive TypeScript declaration files, ensuring a robust developer experience for TypeScript users.","language":"javascript","status":"active","version":"1.2.3","tags":["javascript","mock","xhr","test","fake","request","ajax","browser","xmlhttprequest","typescript"],"last_verified":"Wed May 27","install":[{"cmd":"npm install xhr-mocklet","imports":["import mock from 'xhr-mocklet';","const mock = require('xhr-mocklet');","import type { MockRequest, MockResponse } from 'xhr-mocklet';"]},{"cmd":"yarn add xhr-mocklet","imports":[]},{"cmd":"pnpm add xhr-mocklet","imports":[]}],"homepage":null,"github":"https://github.com/marvinhagemeister/xhr-mocklet","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/xhr-mocklet","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/xhr-mocklet/compatibility"}}