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

Function findByQuery

src/queries/make-queries.ts:196–218  ·  view source on GitHub ↗
(instance: TestInstance)

Source from the content-addressed store, hash-verified

194 }
195
196 function findByQuery(instance: TestInstance) {
197 return function findFn(
198 predicate: Predicate,
199 queryOptions?: Options & WaitForOptions,
200 {
201 onTimeout = (error) => appendElementTreeToError(error),
202 ...waitForOptions
203 }: WaitForOptions = {},
204 ) {
205 const stackTraceError = new ErrorWithStack('STACK_TRACE_ERROR', findFn);
206 const deprecatedWaitForOptions = extractDeprecatedWaitForOptions(queryOptions);
207
208 return waitFor(
209 () => getByQuery(instance, { printElementTree: false })(predicate, queryOptions),
210 {
211 ...deprecatedWaitForOptions,
212 ...waitForOptions,
213 stackTraceError,
214 onTimeout,
215 },
216 );
217 };
218 }
219
220 return {
221 getBy: getByQuery,

Callers

nothing calls this directly

Calls 4

waitForFunction · 0.90
appendElementTreeToErrorFunction · 0.85
getByQueryFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…