MCPcopy
hub / github.com/vercel/next.js / start

Function start

packages/next/src/server/after/after-context.test.ts:192–210  ·  view source on GitHub ↗
(controller)

Source from the content-addressed store, hash-verified

190 const stream = run(() => {
191 return new ReadableStream<string>({
192 async start(controller) {
193 await streamStarted.promise // block the stream to start it manually later
194
195 const delay = () =>
196 new Promise<void>((resolve) => setTimeout(resolve, 50))
197
198 after(afterCallback1)
199 controller.enqueue('one')
200 await delay()
201 expect(waitUntil).toHaveBeenCalledTimes(1) // runCallbacksOnClose
202
203 after(afterCallback2)
204 controller.enqueue('two')
205 await delay()
206 expect(waitUntil).toHaveBeenCalledTimes(1) // runCallbacksOnClose
207
208 await delay()
209 controller.close()
210 },
211 })
212 })
213

Callers

nothing calls this directly

Calls 5

afterFunction · 0.70
delayFunction · 0.70
closeMethod · 0.65
expectFunction · 0.50
enqueueMethod · 0.45

Tested by

no test coverage detected