condition-based-waiting

Replace arbitrary test delays with a condition-based polling utility.

Updated Jul 14, 2025
One-click install
npx skills add https://github.com/woodrowpearson/mids-hero-web --skill condition-based-waiting-woodrowpearson
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: condition-based-waiting
Source: https://github.com/woodrowpearson/mids-hero-web/tree/main/.claude/skills/condition-based-waiting
Command: npx skills add https://github.com/woodrowpearson/mids-hero-web --skill condition-based-waiting-woodrowpearson

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill replaces arbitrary test delays with a reliable condition-based waiting mechanism, reducing flakiness and improving CI stability.

Core Features & Use Cases

  • Condition polling: waitFor(() => state === 'ready') style utility.
  • Unified timeout handling and clear errors.
  • Suitable for unit, integration, and end-to-end tests across synchronous and asynchronous operations.

Quick Start

[indentation-required] AI, wait for the condition to become true with a 5-second timeout.

Frequently Asked Questions about condition-based-waiting

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I eliminate flaky tests caused by arbitrary delays in CI?

You can eliminate flaky tests by replacing arbitrary delays with a condition-based waiting mechanism that polls until the desired state is reached. This provides reliable testing in CI and local environments.

What is condition-based polling and how does it work for async testing?

Condition-based polling is a waitFor utility that continuously checks until a state becomes true, replacing fixed delays. It handles asynchronous operations by polling with a configurable timeout and clear error messaging.

Can I use this waitFor mechanism for unit, integration, and end-to-end tests?

Yes, the waitFor mechanism applies to unit, integration, and end-to-end tests. It handles both synchronous and asynchronous operations, providing unified timeout handling and clear errors across all test types.

How do I configure timeout handling when waiting for a condition in async tests?

You can configure timeout handling by setting a specific duration, such as a 5-second timeout, when calling the waitFor utility. It polls the condition until true or throws a clear error if the timeout is exceeded.

What is the best way to wait for a state to become ready without hardcoded sleep delays?

The best way to wait for a state is using a condition-based waiting utility like waitFor(() => state === 'ready'). This approach polls dynamically rather than sleeping for arbitrary durations, reducing flakiness.

Why does my polling utility fail with a timeout error in CI pipelines?

Your polling utility fails because the condition did not become true within the configured timeout. The condition-based waiting mechanism provides clear error messaging to help diagnose why the desired state was not reached in time.