提交 8ce52eb5 编写于 作者: B Benjamin Pasero

fix tests on windows

上级 f9a2ff4e
......@@ -40,6 +40,7 @@ export interface IConfigOptions<T> {
export class ConfigWatcher<T> implements IConfigWatcher<T>, IDisposable {
private cache: T;
private parseErrors: json.ParseError[];
private disposed: boolean;
private loaded: boolean;
private timeoutHandle: number;
private disposables: IDisposable[];
......@@ -140,6 +141,10 @@ export class ConfigWatcher<T> implements IConfigWatcher<T>, IDisposable {
}
private watch(path: string): void {
if (this.disposed) {
return; // avoid watchers that will never get disposed by checking for being disposed
}
const watcher = fs.watch(path);
watcher.on('change', () => this.onConfigFileChange());
......@@ -201,6 +206,7 @@ export class ConfigWatcher<T> implements IConfigWatcher<T>, IDisposable {
}
public dispose(): void {
this.disposed = true;
this.disposables = dispose(this.disposables);
}
}
\ No newline at end of file
......@@ -130,6 +130,8 @@ suite('Config', () => {
assert.equal(watcher.getConfig().foo, 'changed');
assert.equal(watcher.getValue('foo'), 'changed');
watcher.dispose();
cleanUp(done);
});
}, 50);
......
......@@ -28,7 +28,7 @@ class SettingsTestEnvironmentService extends EnvironmentService {
get appSettingsPath(): string { return this.customAppSettingsHome; }
}
suite('pasero', () => {
suite('ConfigurationService - Node', () => {
function testFile(callback: (path: string, cleanUp: (callback: () => void) => void) => void): void {
const id = uuid.generateUuid();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册