From 8015c2aead024a3e53fb3706486fd72f6ecffe2d Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Wed, 13 Dec 2017 22:17:57 +0300 Subject: [PATCH 1/2] watchPath returns a Promise --- types/atom/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index 4adac61dc1..47cc23d0c3 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -24,7 +24,7 @@ declare global { * Project::onDidChangeFiles instead. */ export function watchPath(rootPath: string, options: {}, eventCallback: (events: - FilesystemChangeEvent) => void): PathWatcher; + FilesystemChangeEvent) => void): Promise; // Essential Classes ========================================================== From 78828b3fb7c864a3491671a21521f991ffaf120f Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Wed, 13 Dec 2017 22:35:49 +0300 Subject: [PATCH 2/2] [atom] update watchPath tests --- types/atom/atom-tests.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/atom/atom-tests.ts b/types/atom/atom-tests.ts index 6ea7b9ae1f..1f5361ce17 100644 --- a/types/atom/atom-tests.ts +++ b/types/atom/atom-tests.ts @@ -1587,7 +1587,8 @@ function testPanel() { } // PathWatcher ================================================================ -function testPathWatcher() { +async function testPathWatcher() { + const pathWatcher = await pathWatcherPromise; pathWatcher.dispose(); subscription = pathWatcher.onDidError((error) => str = error.name); @@ -3213,7 +3214,7 @@ function testWorkspaceCenter() { } // watchPath ================================================================== -const pathWatcher = Atom.watchPath("/var/test", {}, (events) => { +const pathWatcherPromise = Atom.watchPath("/var/test", {}, (events) => { for (const event of events) { str = event.path; str = event.action;