vitest-websocket-mock 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,13 +8,11 @@ A set of utilities and Vitest matchers to help testing complex websocket interac
8
8
  A patched fork of [romgain/jest-websocket-mock](https://github.com/romgain/jest-websocket-mock).
9
9
 
10
10
  **Examples:**
11
- ~~Several examples are provided in the [examples folder](https://github.com/akiomik/vitest-websocket-mock/blob/main/examples/).
12
- In particular:~~
11
+ Several examples are provided in the [examples folder](https://github.com/akiomik/vitest-websocket-mock/blob/main/examples/).
12
+ In particular:
13
13
 
14
- NOTE: These examples are currently not working :cry:
15
-
16
- - [testing a redux saga that manages a websocket connection](https://github.com/akiomik/vitest-websocket-mock/blob/main/examples/redux-saga/src/__tests__/saga.test.js)
17
- - [testing a component using the saga above](https://github.com/akiomik/vitest-websocket-mock/blob/main/examples/redux-saga/src/__tests__/App.test.js)
14
+ - [testing a redux saga that manages a websocket connection](https://github.com/akiomik/vitest-websocket-mock/blob/main/examples/redux-saga/src/__tests__/saga.test.ts)
15
+ - [testing a component using the saga above](https://github.com/akiomik/vitest-websocket-mock/blob/main/examples/redux-saga/src/__tests__/App.test.tsx)
18
16
  - [testing a component that manages a websocket connection using react hooks](https://github.com/akiomik/vitest-websocket-mock/blob/main/examples/hooks/src/App.test.tsx)
19
17
 
20
18
  ## Install
@@ -292,7 +290,7 @@ afterEach(() => {
292
290
 
293
291
  ## Known issues
294
292
 
295
- `mock-socket` has a strong usage of delays (`setTimeout` to be more specific). This means using `vitest.useFakeTimers();` will cause issues such as the client appearing to never connect to the server.
293
+ `mock-socket` has a strong usage of delays (`setTimeout` to be more specific). This means using `vi.useFakeTimers();` will cause issues such as the client appearing to never connect to the server.
296
294
 
297
295
  While running the websocket server from tests within the vitest-dom environment (as opposed to node)
298
296
  you may see errors of the nature:
@@ -343,8 +341,6 @@ restrict yourself to the browser APIs!
343
341
 
344
342
  ## Examples
345
343
 
346
- ~~For a real life example, see the
344
+ For a real life example, see the
347
345
  [examples directory](https://github.com/akiomik/vitest-websocket-mock/tree/main/examples),
348
- and in particular the saga tests.~~
349
-
350
- NOTE: These examples are currently not working :cry:
346
+ and in particular the saga tests.
package/dist/index.js CHANGED
@@ -71,7 +71,8 @@ var WS = class _WS {
71
71
  const { jsonProtocol = false, ...serverOptions } = opts;
72
72
  this.serializer = jsonProtocol ? JSON.stringify : identity;
73
73
  this.deserializer = jsonProtocol ? JSON.parse : identity;
74
- let connectionResolver, closedResolver;
74
+ let connectionResolver;
75
+ let closedResolver;
75
76
  this._isConnected = new Promise((done) => connectionResolver = done);
76
77
  this._isClosed = new Promise((done) => closedResolver = done);
77
78
  this.server = new Server(url, serverOptions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest-websocket-mock",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Mock websockets and assert complex websocket interactions with Vitest",
5
5
  "type": "module",
6
6
  "repository": {
@@ -34,22 +34,24 @@
34
34
  "author": "Akiomi Kamakura",
35
35
  "license": "MIT",
36
36
  "devDependencies": {
37
- "@typescript-eslint/eslint-plugin": "^5.45.0",
38
- "@typescript-eslint/parser": "^5.45.0",
39
- "@vitest/coverage-c8": "^0.32.2",
40
- "eslint": "^8.28.0",
37
+ "@typescript-eslint/eslint-plugin": "^5.59.0",
38
+ "@typescript-eslint/parser": "^5.59.0",
39
+ "@vitest/coverage-v8": "^0.32.2",
40
+ "eslint": "^8.38.0",
41
41
  "eslint-config-prettier": "^8.5.0",
42
42
  "eslint-config-react-app": "^7.0.1",
43
+ "eslint-plugin-react-hooks": "^4.6.0",
44
+ "eslint-plugin-react-refresh": "^0.3.4",
43
45
  "eslint-plugin-simple-import-sort": "^10.0.0",
44
46
  "prettier": "^2.0.2",
45
47
  "rimraf": "^4.1.2",
46
48
  "tsup": "^7.0.0",
47
49
  "typescript": "^4.0.2",
48
50
  "vite": "^4.3.9",
49
- "vitest": "^0.31.0"
51
+ "vitest": "^0.32.0"
50
52
  },
51
53
  "peerDependencies": {
52
- "vitest": "^0.31.0"
54
+ "vitest": "^0.32.0"
53
55
  },
54
56
  "dependencies": {
55
57
  "jest-diff": "^29.2.0",