diff options
author | Matt Mastracci <matthew@mastracci.com> | 2024-03-01 13:48:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-01 13:48:09 -0700 |
commit | 22a4205a68672764dda5d66f5c9595d1fb538df4 (patch) | |
tree | 5b51922f1ac87defafe5012dd70005c49df92eb6 /tests/unit_node/zlib_test.ts | |
parent | 736b91edd002ae34082c473b37249f9256a6ba32 (diff) |
chore(core): fix zlib_test sanitizer failures (#22659)
Diffstat (limited to 'tests/unit_node/zlib_test.ts')
-rw-r--r-- | tests/unit_node/zlib_test.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/unit_node/zlib_test.ts b/tests/unit_node/zlib_test.ts index 7e3f97481..94b1c63ca 100644 --- a/tests/unit_node/zlib_test.ts +++ b/tests/unit_node/zlib_test.ts @@ -44,7 +44,7 @@ Deno.test("gzip compression sync", { sanitizeResources: false }, () => { }); Deno.test("brotli compression", async () => { - const { promise, resolve } = Promise.withResolvers<void>(); + const promise = Promise.withResolvers<void>(); const compress = createBrotliCompress(); const filePath = relative( Deno.cwd(), @@ -61,13 +61,14 @@ Deno.test("brotli compression", async () => { const output2 = createWriteStream("lorem_ipsum.txt"); const stream2 = input2.pipe(decompress).pipe(output2); - - stream2.on("finish", () => { - resolve(); - }); + stream2.on("close", () => promise.resolve()); }); - await promise; + await Promise.all([ + promise.promise, + new Promise((r) => stream.on("close", r)), + ]); + const content = Deno.readTextFileSync("lorem_ipsum.txt"); assert(content.startsWith("Lorem ipsum dolor sit amet")); try { |