MCPcopy Create free account
hub / github.com/TanStack/db / waitForTrailBase

Function waitForTrailBase

packages/trailbase-db-collection/e2e/global-setup.ts:94–117  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

92}
93
94async function waitForTrailBase(url: string): Promise<void> {
95 return new Promise<void>((resolve, reject) => {
96 const timeout = setTimeout(() => {
97 reject(
98 new Error(`Timed out waiting for TrailBase to be active at ${url}`),
99 )
100 }, 60000) // 60 seconds timeout for startup
101
102 const check = async (): Promise<void> => {
103 try {
104 // Try the healthz endpoint first, then fall back to root
105 const res = await fetch(`${url}/api/healthcheck`)
106 if (res.ok) {
107 clearTimeout(timeout)
108 return resolve()
109 }
110 } catch {}
111
112 setTimeout(() => void check(), 500)
113 }
114
115 void check()
116 })
117}
118
119/**
120 * Global setup for TrailBase e2e test suite

Callers 1

global-setup.tsFile · 0.85

Calls 1

checkFunction · 0.70

Tested by

no test coverage detected