MCPcopy Create free account
hub / github.com/TanStack/cli / attempt

Function attempt

packages/cli/tests-e2e/helpers.ts:91–108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

89 const started = Date.now()
90 return new Promise<void>((resolvePromise, rejectPromise) => {
91 const attempt = async () => {
92 try {
93 const response = await fetch(url)
94 if (response.ok) {
95 resolvePromise()
96 return
97 }
98 } catch {
99 // keep waiting
100 }
101
102 if (Date.now() - started > timeoutMs) {
103 rejectPromise(new Error(`Timed out waiting for server: ${url}`))
104 return
105 }
106
107 setTimeout(attempt, 500)
108 }
109
110 void attempt()
111 })

Callers 2

waitForServerFunction · 0.85
waitForDevServerURLFunction · 0.85

Calls 3

stripAnsiFunction · 0.85
nowMethod · 0.80
replaceMethod · 0.65

Tested by

no test coverage detected