deno.land / x / denon@2.5.0 / src / watcher.test.ts
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970// Copyright 2020-2021 the denosaurs team. All rights reserved. MIT license.
import { assert } from "../test_deps.ts";
import { Watcher, WatcherConfig } from "./watcher.ts";
Deno.test({ name: "watcher | exts", fn(): void { const config: WatcherConfig = { paths: [Deno.cwd()], interval: 350, exts: ["json"], skip: [], match: [], };
const watcher = new Watcher(config); assert( !watcher.isWatched("src/args.ts"), "should not match because of extension", );
config.exts = []; config.skip = ["src/*"]; watcher.reload(); assert( !watcher.isWatched("src/args.ts"), "should not match because parent dir is skipped", );
config.exts = []; config.skip = []; config.match = ["lib/*"]; watcher.reload(); assert( !watcher.isWatched("src/args.ts"), "should not match because parent dir is not matched", );
config.exts = [".ts"]; config.skip = []; config.match = ["**"]; watcher.reload(); assert( watcher.isWatched("src/args.ts"), "should match because of extensions", ); },});
Deno.test({ name: "watcher | skip", fn(): void { const config: WatcherConfig = { paths: [Deno.cwd()], interval: 350, exts: [], skip: ["src/*"], match: [], };
const watcher = new Watcher(config); assert( !watcher.isWatched("src/args.ts"), "should not match because parent dir is skipped", ); },});
Version Info
External Dependencies