MCPcopy Index your code
hub / github.com/netlify/cli / startDevServer

Function startDevServer

tests/integration/utils/dev-server.ts:245–269  ·  view source on GitHub ↗
(options: DevServerOptions, expectFailure?: boolean)

Source from the content-addressed store, hash-verified

243}
244
245export const startDevServer = async (options: DevServerOptions, expectFailure?: boolean): Promise<DevServer> => {
246 const maxAttempts = 5
247
248 for (let attempt = 1; attempt <= maxAttempts; attempt++) {
249 try {
250 // do not use destruction, as we use getters which otherwise would be evaluated here
251 const devServer = await startServer({ ...options, expectFailure })
252 if ('timeout' in devServer && devServer.timeout) {
253 throw new Error(
254 `Timed out starting dev server.\nServer Output:\n${devServer.output}\nServer Error:\n${
255 devServer.error ?? ''
256 }\nDiagnostic Report:\n${devServer.report ?? '(none captured)'}`,
257 )
258 }
259 return devServer as DevServer
260 } catch (error) {
261 if (attempt === maxAttempts || expectFailure) {
262 throw error
263 }
264 console.warn('Retrying startDevServer', error)
265 }
266 }
267
268 throw new Error('this code should be unreachable')
269}
270
271export const withDevServer = async <T>(
272 options: DevServerOptions,

Callers 2

withDevServerFunction · 0.85
setupFixtureTestsFunction · 0.85

Calls 2

startServerFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected