deno.land / x / denon@2.5.0 / src / watcher.test.ts

watcher.test.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// 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", ); },});
denon

Version Info

Tagged at
2 years ago