From 508cd0f275ea99ebbaeb7019fea118f80ed445c8 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Fri, 9 May 2025 21:14:23 +0200 Subject: [PATCH] test: deflake test-http2-client-socket-destroy The socket can be destroyed by the other peer while data is still being written. Add a listener for the `'error'` event. PR-URL: https://github.com/nodejs/node/pull/58212 Reviewed-By: Joyee Cheung Reviewed-By: Jake Yuesong Li --- test/parallel/test-http2-client-socket-destroy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/parallel/test-http2-client-socket-destroy.js b/test/parallel/test-http2-client-socket-destroy.js index 2cc6ef1e4ea..1c0fa54f11c 100644 --- a/test/parallel/test-http2-client-socket-destroy.js +++ b/test/parallel/test-http2-client-socket-destroy.js @@ -15,6 +15,7 @@ const server = h2.createServer(); // We use the lower-level API here server.on('stream', common.mustCall((stream) => { + stream.on('error', () => {}); stream.on('aborted', common.mustCall()); stream.on('close', common.mustCall()); stream.respond();