Watch for changes in directory structure

This ensures that directories renamed, added or deleted are
properly checked to see if they contain tests. The test tree
will be correctly updated when any directory changes.s
This commit is contained in:
Andrew Eisenberg
2021-04-23 14:13:44 -07:00
parent f6c67bf696
commit dc5efcedba

View File

@@ -167,9 +167,11 @@ export class QLTestDiscovery extends Discovery<QLTestDiscoveryResults> {
protected update(results: QLTestDiscoveryResults): void { protected update(results: QLTestDiscoveryResults): void {
this._testDirectory = results.testDirectory; this._testDirectory = results.testDirectory;
// Watch for changes to any `.ql` or `.qlref` file in any of the QL packs that contain tests.
this.watcher.clear(); this.watcher.clear();
// Watch for changes to any `.ql` or `.qlref` file in any of the QL packs that contain tests.
this.watcher.addWatch(new RelativePattern(results.watchPath, '**/*.{ql,qlref}')); this.watcher.addWatch(new RelativePattern(results.watchPath, '**/*.{ql,qlref}'));
// need to explicitly watch for changes to directories themselves.
this.watcher.addWatch(new RelativePattern(results.watchPath, '**/'));
this._onDidChangeTests.fire(); this._onDidChangeTests.fire();
} }