From b908af0b48d8cafe632bc6bd89ac17032e9ac928 Mon Sep 17 00:00:00 2001 From: Lam Wei Li Date: Tue, 2 Aug 2022 15:34:19 +0800 Subject: [PATCH] fix: an issue where test hangs when assertion fails in http2 as http2server is not closed --- test/compression.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/compression.js b/test/compression.js index 85d4632..1bff32e 100644 --- a/test/compression.js +++ b/test/compression.js @@ -336,9 +336,11 @@ describe('compression()', function () { chunks.push(chunk); }) request.on('end', function () { - zlib.gunzip(Buffer.concat(chunks), function(err, data) { - assert.strictEqual(data.toString(), 'hello, world') - closeHttp2(client, server, done) + closeHttp2(client, server, function () { + zlib.gunzip(Buffer.concat(chunks), function(err, data) { + assert.strictEqual(data.toString(), 'hello, world') + done() + }) }) }) request.end()