mirror of
https://github.com/denoland/deno.git
synced 2024-12-24 08:09:08 -05:00
fix(ext/node): pass normalized watchFile handler to StatWatcher (#22940)
Fixes https://github.com/denoland/deno/issues/22939
This commit is contained in:
parent
ab67b4c645
commit
9c5ddf7c69
2 changed files with 15 additions and 2 deletions
|
@ -211,7 +211,7 @@ export function watchFile(
|
|||
statWatchers.set(watchPath, stat);
|
||||
}
|
||||
|
||||
stat.addListener("change", listener!);
|
||||
stat.addListener("change", handler);
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
import { watch } from "node:fs";
|
||||
import { unwatchFile, watch, watchFile } from "node:fs";
|
||||
import { assertEquals } from "@std/assert/mod.ts";
|
||||
|
||||
function wait(time: number) {
|
||||
|
@ -25,3 +25,16 @@ Deno.test({
|
|||
assertEquals(result.length >= 1, true);
|
||||
},
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "watching a file with options",
|
||||
async fn() {
|
||||
const file = Deno.makeTempFileSync();
|
||||
watchFile(
|
||||
file,
|
||||
() => {},
|
||||
);
|
||||
await wait(100);
|
||||
unwatchFile(file);
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue