MCPcopy Create free account
hub / github.com/anthropics/claude-code / expectTimedOutWaits

Function expectTimedOutWaits

mods/diff/tests/register.test.ts:390–423  ·  view source on GitHub ↗
(
    $: Engine,
    on: On,
    options: SlowReadsOptions,
  )

Source from the content-addressed store, hash-verified

388 })
389
390 async function expectTimedOutWaits(
391 $: Engine,
392 on: On,
393 options: SlowReadsOptions,
394 ) {
395 const { reads, clock, command } = await slowReads(
396 $,
397 on,
398 Limits.GIT_TIMEOUT_MS,
399 { deny: Fixtures.GIT_HUNG },
400 options,
401 )
402
403 await clock.advance(Limits.GIT_TIMEOUT_MS + Fixtures.SETTLE_MS)
404 await command()
405 await clock.advance(Limits.TIMED_OUT_REST_MS - 2 * Fixtures.SETTLE_MS)
406
407 expect(reads, 'held for the first wait').toHaveLength(1)
408
409 await clock.advance(2 * Fixtures.SETTLE_MS)
410
411 expect(reads, 'read once it ended').toHaveLength(2)
412
413 await clock.advance(Limits.GIT_TIMEOUT_MS + Fixtures.SETTLE_MS)
414 await command()
415
416 await clock.advance(2 * Limits.TIMED_OUT_REST_MS - 3 * Fixtures.SETTLE_MS)
417
418 expect(reads, 'a second timeout doubles the wait').toHaveLength(2)
419
420 await clock.advance(2 * Fixtures.SETTLE_MS)
421
422 expect(reads).toHaveLength(3)
423 }
424
425 test('after git times out, commands wait, and a second timeout doubles it', ($, on) =>
426 expectTimedOutWaits($, on, { isOpenedByDiff: true }))

Callers 1

register.test.tsFile · 0.85

Calls 2

slowReadsFunction · 0.85
commandFunction · 0.85

Tested by

no test coverage detected