Cypress Mock WebSocket Plugin

JSON →
library 2.0.0 ·javascript
verified Jun 7, 2026

A Cypress plugin to mock WebSocket connections using a cy.intercept-style API. Current stable version is 2.0.0. It allows defining request/response pairs that the app receives during Cypress tests, supports partial matching via ts-pattern, and works with rxjs WebSocket and Apollo GraphQL subscriptions. Key differentiators: runs on top of Cypress's built-in WebSocket communication (no separate mock server needed), supports both a custom constructor and native WebSocket API, and provides static response registration as well as dynamic request handlers.