danthemanD
Denoβ€’3y agoβ€’
1 reply
dantheman

How to release node:zlib resources

I have some testcases which use the node:zlib polyfill and I'm having a bit of trouble getting the tests to pass. Here's a very basic example:
import { createDeflate } from 'node:zlib';
Deno.test('deflate teardown', async () => {
  const deflate = createDeflate();
  deflate.close();
  await new Promise(ok => setTimeout(ok, 1000));
});

When I run this, Deno finds a leak:
error: Leaking resources:
  - A "zlib" resource (rid 3) was created during the test, but not cleaned up during the test. Close the resource before the end of the test.

Am I missing something, or is this an issue with the node:zlib polyfill?
Was this page helpful?