diff --git a/cli/tests/unit_node/zlib_test.ts b/cli/tests/unit_node/zlib_test.ts index 5f82b12027..fc9eaeb5bf 100644 --- a/cli/tests/unit_node/zlib_test.ts +++ b/cli/tests/unit_node/zlib_test.ts @@ -81,3 +81,18 @@ Deno.test( await promise; }, ); + +Deno.test( + "zlib flush i32", + // FIXME: Handle is not closed properly + { sanitizeResources: false }, + function () { + const handle = createDeflate({ + // @ts-expect-error: passing non-int flush value + flush: "", + }); + + handle.end(); + handle.destroy(); + }, +); diff --git a/ext/node/polyfills/_zlib_binding.mjs b/ext/node/polyfills/_zlib_binding.mjs index 0b155cfd51..30bd1400ae 100644 --- a/ext/node/polyfills/_zlib_binding.mjs +++ b/ext/node/polyfills/_zlib_binding.mjs @@ -120,7 +120,7 @@ class Zlib { core.opAsync( "op_zlib_write_async", this.#handle, - flush, + flush ?? Z_NO_FLUSH, input, in_off, in_len,