We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bbef100 commit 584c806Copy full SHA for 584c806
src/wait.ts
@@ -34,11 +34,14 @@ export function waitFor<T>(getter: () => T, options: {
34
return new Promise(rs => setTimeout(rs, options.interval)).then(wait);
35
}
36
37
+ // We generate the error here to capture the stack trace, but we will only throw it if it times out
38
+ const timeoutError = new Error(options.present ? 'Element not found' : 'Element not removed');
39
+
40
return Promise.race([
41
new Promise(
42
(_, rj) => setTimeout(() => {
43
timedOut = true;
- rj(new Error(options.present ? 'Element not found' : 'Element not removed'));
44
+ rj(timeoutError);
45
}, options.timeout)
46
),
47
wait()
0 commit comments