comfyui-node 1.6.4 → 1.6.6

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
@@ -186,12 +186,14 @@ const results = await pool.waitForJobCompletion(sdxlJobId);
186
186
  console.log("SDXL Job completed!", results.images);
187
187
  ```
188
188
 
189
- ## What's New in v1.5.0
189
+ ## What's New in v1.6.5
190
190
 
191
- - **WorkflowPool Profiling** – Enable automatic per-node performance tracking with `enableProfiling: true`.
192
- - **Timeout Protection** Prevent jobs from hanging with `executionStartTimeoutMs` and `nodeExecutionTimeoutMs`.
193
- - **Idle connection stability** Automatic health checks keep WebSocket connections alive.
194
- - **Better DX** – Comprehensive JSDoc comments and exported types for all pool options.
191
+ - **Integration Test Infrastructure** – Comprehensive reconnection testing with real mock server processes
192
+ - Mock servers spawn in separate OS processes that can be killed/restarted
193
+ - 13 integration tests covering manual/auto-reconnection, state transitions, and multiple restart cycles
194
+ - Test helpers and utilities for easy test development
195
+ - 900+ lines of documentation with quick-start guide and examples
196
+ - Run with: `bun test test/integration/` or `bun run test:integration`
195
197
 
196
198
  See [CHANGELOG.md](./CHANGELOG.md) for complete release notes.
197
199
 
@@ -250,11 +252,71 @@ job.on('failed', err => console.error(err));
250
252
 
251
253
  ## Testing
252
254
 
255
+ ### Unit and Integration Tests
256
+
257
+ ```bash
258
+ bun test # Unit + integration tests
259
+ bun run test:integration # Run all integration tests
260
+ bun run test:integration:simple # Run simple reconnection examples
261
+ bun run test:real # Real server tests (COMFY_REAL=1)
262
+ bun run test:full # Comprehensive tests (COMFY_FULL=1)
263
+ bun run coverage # Coverage report
264
+ ```
265
+
266
+ ### Integration Tests (v1.6.5+)
267
+
268
+ The library includes a comprehensive integration test infrastructure that spawns real mock server processes to test reconnection behavior:
269
+
253
270
  ```bash
254
- bun test # Unit + integration tests
255
- bun run test:real # Real server tests (COMFY_REAL=1)
256
- bun run test:full # Comprehensive tests (COMFY_FULL=1)
257
- bun run coverage # Coverage report
271
+ # Run all integration tests
272
+ bun test test/integration/
273
+
274
+ # Run simple examples (recommended first)
275
+ bun run test:integration:simple
276
+
277
+ # Validate the mock server infrastructure
278
+ bun test/integration/validate-mock-server.ts
279
+
280
+ # Debug: Run mock server standalone
281
+ bun test/integration/mock-server.ts 8191
282
+ ```
283
+
284
+ **What's Tested:**
285
+ - Manual and automatic reconnection after server crashes
286
+ - Connection state transitions (connecting → connected → disconnected → reconnecting)
287
+ - Event emission (`reconnected`, `reconnection_failed`)
288
+ - Multiple server restart cycles
289
+ - WebSocket message handling across reconnections
290
+
291
+ **Documentation:**
292
+ - `test/integration/README.md` – Comprehensive guide
293
+ - `test/integration/QUICKSTART.md` – Developer quick-start with patterns
294
+ - `test/integration/SUMMARY.md` – Architecture overview
295
+
296
+ **Example:**
297
+ ```ts
298
+ // Integration test pattern
299
+ const manager = new ServerManager({ port: 8191 });
300
+ await manager.startServer(8191);
301
+
302
+ const api = new ComfyApi("http://localhost:8191");
303
+ await initializeClient(api);
304
+
305
+ // Kill server to simulate crash
306
+ await manager.killServer(8191);
307
+ await sleep(500);
308
+
309
+ // Restart server
310
+ await manager.startServer(8191);
311
+
312
+ // Verify reconnection
313
+ await api.reconnectWs(true);
314
+ await waitForConnection(api);
315
+ expect(api.isConnected()).toBe(true);
316
+
317
+ // Cleanup
318
+ api.destroy();
319
+ await manager.killAll();
258
320
  ```
259
321
 
260
322
  See [Troubleshooting docs](./docs/troubleshooting.md#testing--coverage) for details.