test(phase-1): add unit and full-stack integration tests and await watcher ready
This commit is contained in:
parent
ce7e42fbc2
commit
df030ba8ba
5 changed files with 922 additions and 2 deletions
|
|
@ -117,7 +117,7 @@ export class ConfigManager {
|
|||
this.recomputeWarnings();
|
||||
|
||||
if (options.watch !== false) {
|
||||
this.startWatcher();
|
||||
await this.startWatcher();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -547,7 +547,7 @@ export class ConfigManager {
|
|||
);
|
||||
}
|
||||
|
||||
private startWatcher(): void {
|
||||
private startWatcher(): Promise<void> {
|
||||
this.watcher = chokidar.watch(this.configDir, {
|
||||
ignoreInitial: true,
|
||||
persistent: true,
|
||||
|
|
@ -577,6 +577,10 @@ export class ConfigManager {
|
|||
this.watcher.on('add', (p) => scheduleReload(p, 'upsert'));
|
||||
this.watcher.on('change', (p) => scheduleReload(p, 'upsert'));
|
||||
this.watcher.on('unlink', (p) => scheduleReload(p, 'unlink'));
|
||||
|
||||
return new Promise<void>((resolve) => {
|
||||
this.watcher!.once('ready', () => resolve());
|
||||
});
|
||||
}
|
||||
|
||||
private handleExternalUpsert(relPath: string): void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue