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

Function waitForDevServerURL

packages/cli/tests-e2e/helpers.ts:118–140  ·  view source on GitHub ↗
(getStdout: () => string, timeoutMs = 90_000)

Source from the content-addressed store, hash-verified

116}
117
118function waitForDevServerURL(getStdout: () => string, timeoutMs = 90_000) {
119 const started = Date.now()
120
121 return new Promise<string>((resolvePromise, rejectPromise) => {
122 const attempt = () => {
123 const stdout = stripAnsi(getStdout())
124 const match = stdout.match(/Local:\s+(https?:\/\/[^\s]+)/)
125 if (match?.[1]) {
126 resolvePromise(match[1].replace(/\/$/, ''))
127 return
128 }
129
130 if (Date.now() - started > timeoutMs) {
131 rejectPromise(new Error('Timed out waiting for dev server URL in output'))
132 return
133 }
134
135 setTimeout(attempt, 250)
136 }
137
138 attempt()
139 })
140}
141
142async function stopChild(child: ReturnType<typeof spawn>) {
143 if (child.killed || child.exitCode !== null) {

Callers 1

createAppFixtureFunction · 0.85

Calls 2

attemptFunction · 0.85
nowMethod · 0.80

Tested by

no test coverage detected