• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rokucommunity / brighterscript / #11418

08 Jan 2024 02:59PM UTC coverage: 88.089% (+0.02%) from 88.072%
#11418

push

web-flow
Prevent publishing of empty files (#997)

* Added file exclusion for empty files

* Added unit tests

* address comments

* fix unit tests for windows

* change use of verb from publish to prune and invert logic

* ensure uriAttributeValue is a string

* add test case for empty brs file

* Apply suggestions from code review

---------

Co-authored-by: Bronley Plumb <bronley@gmail.com>

5752 of 7005 branches covered (0.0%)

Branch coverage included in aggregate %.

8610 of 9299 relevant lines covered (92.59%)

1657.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

11.11
/src/Watcher.ts
1
import * as chokidar from 'chokidar';
1✔
2

3
import type { BsConfig } from './BsConfig';
4

5
/**
6
 * There are some bugs with chokidar, so this attempts to mitigate them
7
 */
8
export class Watcher {
1✔
9
    constructor(
10
        private options: BsConfig
×
11
    ) {
12

13
    }
14

15
    private watchers = <chokidar.FSWatcher[]>[];
×
16

17
    /**
18
     * Watch the paths or globs
19
     */
20
    public watch(paths: string | string[]) {
21
        let watcher = chokidar.watch(paths, {
×
22
            cwd: this.options.rootDir,
23
            ignoreInitial: true,
24
            awaitWriteFinish: {
25
                stabilityThreshold: 200,
26
                pollInterval: 100
27
            }
28
        });
29
        this.watchers.push(watcher);
×
30

31
        return async () => {
×
32
            //unwatch all paths
33
            watcher.unwatch(paths);
×
34
            //close the watcher
35
            await watcher.close();
×
36
            //remove the watcher from our list
37
            this.watchers.splice(this.watchers.indexOf(watcher), 1);
×
38
        };
39
    }
40

41
    /**
42
     * Be notified of all events
43
     */
44
    public on(event: 'all', callback: (event, path, details) => void) {
45
        let watchers = [...this.watchers];
×
46
        for (let watcher of watchers) {
×
47
            watcher.on(event, callback);
×
48
        }
49

50
        //a disconnect function
51
        return () => {
×
52
            for (let watcher of watchers) {
×
53
                watcher.removeListener('all', callback);
×
54
            }
55
        };
56
    }
57

58
    public dispose() {
59
        for (let watcher of this.watchers) {
×
60
            watcher.removeAllListeners();
×
61
        }
62
    }
63
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc