diff --git a/package.json b/package.json index 289b04f..da0c8ea 100644 --- a/package.json +++ b/package.json @@ -78,6 +78,7 @@ "transform": { "^.+\\.(js|jsx|ts|tsx)$": "babel-jest" }, - "testRegex": "/src/.*\\.spec\\.(js|ts|tsx)$" + "testRegex": "/src/.*\\.spec\\.(js|ts|tsx)$", + "testURL": "http://localhost/" } } diff --git a/src/index.d.ts b/src/index.d.ts index c425252..049a6e1 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -6,4 +6,4 @@ * @param interval Number Wait-between-retries interval, 50ms by default * @return Promise Promise to return a callback result */ -export default function waitForExpect(expectation: () => void, timeout?: number, interval?: number): any; +export default function waitForExpect(expectation: () => void | Promise, timeout?: number, interval?: number): any; diff --git a/src/index.ts b/src/index.ts index 350f7cf..8d81984 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,7 +14,7 @@ const defaults = { * @return Promise Promise to return a callback result */ const waitForExpect = function waitForExpect( - expectation: () => void, + expectation: () => void | Promise, timeout = defaults.timeout, interval = defaults.interval ) {