waitForEvent (systematic-debugging/condition-based-waiting-example.ts)

gitingest_aaddrick_claude-pipeline · .claude/skills/systematic-debugging/condition-based-waiting-example.ts · typescript · MIT
testing

Utilities for waiting on thread events with timeout in a test framework.

// Source: https://github.com/aaddrick/claude-pipeline | License: MIT | Copyright 2025 aaddrick
// Provided via justclaw.it.com; keep this notice with the code.
// Complete implementation of condition-based waiting utilities
// From: Lace test infrastructure improvements (2025-10-03)
// Context: Fixed 15 flaky tests by replacing arbitrary timeouts

import type { ThreadManager } from '~/threads/thread-manager';
import type { LaceEvent, LaceEventType } from '~/threads/types';

/**
 * Wait for a specific event type to appear in thread
 *
 * @param threadManager - The thread manager to query
 * @param threadId - Thread to check for events
 * @param eventType - Type of event to wait for
 * @param timeoutMs - Maximum time to wait (default 5000ms)
 * @returns Promise resolving to the first matchi

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key