MCPcopy
hub / github.com/callstack/react-native-testing-library / handleTimeout

Function handleTimeout

src/wait-for.ts:191–218  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

189 }
190
191 function handleTimeout() {
192 let error: Error;
193 if (lastError) {
194 if (lastError instanceof Error) {
195 error = lastError;
196 } else {
197 error = new Error(String(lastError));
198 }
199
200 copyStackTraceIfNeeded(error, stackTraceError);
201 } else {
202 error = new Error('Timed out in waitFor.');
203 copyStackTraceIfNeeded(error, stackTraceError);
204 }
205
206 let errorForRejection: unknown = error;
207 if (typeof onTimeout === 'function') {
208 try {
209 const result = onTimeout(error);
210 if (result) {
211 errorForRejection = result;
212 }
213 } catch (onTimeoutError) {
214 errorForRejection = onTimeoutError;
215 }
216 }
217 onDone({ type: 'error', error: errorForRejection });
218 }
219 });
220}
221

Callers 1

waitForInternalFunction · 0.85

Calls 2

copyStackTraceIfNeededFunction · 0.90
onDoneFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…