diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2020-07-24 02:33:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-23 21:33:52 -0400 |
commit | b61347b2552cb7159ee3e82c5e9ca5a76e73c3f8 (patch) | |
tree | f931a4be2b0435eb3b216813cb946838b9e606bc /cli/tests | |
parent | c2507d95f5a196791bca83630198c064a1fb460a (diff) |
fix(cli/js/ops/fs_events): Ignore polling errors caused by return() (#6785)
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/unit/fs_events_test.ts | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/cli/tests/unit/fs_events_test.ts b/cli/tests/unit/fs_events_test.ts index f2dd59d79..d73001187 100644 --- a/cli/tests/unit/fs_events_test.ts +++ b/cli/tests/unit/fs_events_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { unitTest, assert, assertThrows } from "./test_util.ts"; +import { unitTest, assert, assertEquals, assertThrows } from "./test_util.ts"; // TODO(ry) Add more tests to specify format. @@ -60,3 +60,21 @@ unitTest( assert(events[1].paths[0].includes(testDir)); }, ); + +unitTest( + { perms: { read: true, write: true } }, + async function watchFsReturn(): Promise<void> { + const testDir = await Deno.makeTempDir(); + const iter = Deno.watchFs(testDir); + + // Asynchronously loop events. + const eventsPromise = getTwoEvents(iter); + + // Close the watcher. + await iter.return!(); + + // Expect zero events. + const events = await eventsPromise; + assertEquals(events, []); + }, +); |