From 5b2f689f085fea8ff52f296c94072a1fb29dd054 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Wed, 20 Mar 2024 11:19:53 +0530 Subject: fix(ext/node): FsWatcher ref and unref (#22987) Fixes https://github.com/denoland/deno/issues/22973 --------- Co-authored-by: Satya Rohith --- tests/unit_node/_fs/_fs_watch_test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/unit_node/_fs/_fs_watch_test.ts') diff --git a/tests/unit_node/_fs/_fs_watch_test.ts b/tests/unit_node/_fs/_fs_watch_test.ts index 01236a493..8e2fb619c 100644 --- a/tests/unit_node/_fs/_fs_watch_test.ts +++ b/tests/unit_node/_fs/_fs_watch_test.ts @@ -38,3 +38,17 @@ Deno.test({ unwatchFile(file); }, }); + +Deno.test({ + name: "watch.unref() should work", + sanitizeOps: false, + sanitizeResources: false, + async fn() { + const file = Deno.makeTempFileSync(); + const watcher = watch(file, () => {}); + // Wait for the watcher to be initialized + await wait(10); + // @ts-ignore node types are outdated in deno. + watcher.unref(); + }, +}); -- cgit v1.2.3