jest-websocket-mock icon indicating copy to clipboard operation
jest-websocket-mock copied to clipboard

Mock websockets and assert complex websocket interactions with Jest

Results 16 jest-websocket-mock issues
Sort by recently updated
recently updated
newest added

I have installed this package and tried to import the module (as per the examples) in my test file, however, when trying to run the tests, I get the following...

At https://github.com/romgain/jest-websocket-mock/blob/cf0695a30d78dda0bd9e503753fb37124f38eccd/src/websocket.ts#L49-L50 are defined `_isConnected` to be resolved when a new connection is established, and `_isClossed` when the WebSockets server gets clossed. I think there should be a mechanism to...

I'm trying to get this example from the README to work: ```js import WS from 'jest-websocket-mock'; it('tests websocket', async () => { const server = new WS("ws://localhost:1234"); const client =...

When using the library, I run the tests and the suite completes fine. However, I get a warning from a jest that there might be open handles. When I run...

It would be nice to be able to do .toReceiveMessage with behaviour similar to .toMatchObject . My use case: I know what I expect the client to send, but each...

help wanted
good first issue

I am currently utilizing this library to mock communication between my frontend app and an IRC gateway called [webircgateway](https://github.com/kiwiirc/webircgateway) for my unit tests, and I wasn't able to find a...

enhancement

Hi, I have a unit test that is something along the line of ``` it('retries to connect to the websocket connection after 5 seconds on error'){ await server.connected server.error(); await...

enhancement

Bumps [jest](https://github.com/facebook/jest/tree/HEAD/packages/jest) from 28.1.3 to 29.2.1. Release notes Sourced from jest's releases. v29.2.1 Features [@jest/globals, jest-mock] Add jest.Spied* utility types (#13440) Fixes [jest-environment-node] make globalThis.performance writable for Node 19 and...

dependencies

Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 28.1.8 to 29.2.0. Commits See full diff in compare view [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/jest&package-manager=npm_and_yarn&previous-version=28.1.8&new-version=29.2.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter...

dependencies

The example from the readme works fine: ```ts test("the server keeps track of received messages, and yields them as they come in", async () => { const server = new...