/biloba-vitest:flaky-testsfrom biloba-vitest
Diagnoses and prevents flaky Biloba TypeScript/Vitest tests by identifying common race conditions: redundant retry loops, single-shot reads, optimistic UI, async layout, network handler shadowing, held responses, vacuous assertions, visual tolerance hazards, lifecycle leakage, and timer-driven UI issues.
Ships in biloba-vitest. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Biloba actions and assertions already poll inside bilobad. Start by deleting outer retries:
// Good: one request; the daemon owns the retry loop.
await session.getByRole("button", {name: "Save"}).click({timeoutMs: 5_000});
await session.getByTestId("status").expectText("Saved");
Do not wrap these calls in expect.poll, waitFor, sleeps, or a loop. Outer polling hides the useful inner failure and adds a process round trip per attempt. Avoid {mode: "immediate"} and {immediate: true} unless the test genuinely requires a single observation.
evaluate() reads once. Poll with expectEvaluation() when the value must become true.AssertionResult.observed value from the successful assertion when available instead of taking a second page read.holdResponse().data-ready from the mount effect, or a state-specific attribute), not on the element or its text.getBoundingClientRect() evaluation.count(), stats(), or networkShadowDiagnostics() to prove the intended handler fired; remove handlers when their scope ends.finally. A leaked hold makes the next failure look unrelated.prepare() before every test, and close worker browsers in afterAll.biloba-vitest:flake-hunt).setTimeout (a debounce, a toast that hides after 3s, a countdown, a session expiry) is slow when it works and flaky when the timer races the poll deadline. Don't widen the timeout: installClock(t0) before navigate(), pauseAt(t0), then runFor(ms) or fastForward(ms) (biloba-vitest:write-tests §8). installClock alone keeps time flowing at the real rate, so without the pauseAt a chain of timers can finish before the first poll looks.clearTimeout(t); t = setTimeout(sync, 120) is reset by every DOM change, so on a page that streams or animates the derived UI never updates. Whether a quiet gap appears depends on load, so the test can pass alone and fail in every full run. It's a product bug: throttle instead (if (!t) t = setTimeout(() => { t = 0; sync() }, 120)), and add a test that churns the DOM while it acts.This tab's page clock is paused at <t>; ... means the page's timers never ran — call runFor, fastForward, or resume before the assertion.BILOBA_UPDATE_SCREENSHOTS, updateScreenshots) in CI.On failure, read BilobaError.trajectory before increasing timeouts. Flat means waiting longer will not help. Artifacts → biloba-vitest:debug-failures. Measuring a flake's rate, or confirming a fix → biloba-vitest:flake-hunt. Visual workflow → biloba-vitest:visual-assertions. Docs: https://onsi.github.io/biloba/vitest.html.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
7 skills in this plugin
/debug-failuresDiagnose Biloba failures in TypeScript/Vitest — BilobaError codes and fields, polling trajectories, DOM outlines, screenshots and visual artifacts, context-wide session.captureDiagnostics(), console/warning streams, debug logs, Vitest hooks, and renderer/browser/daemon crash distinctions. Use when a Biloba Vitest test fails, hangs, flakes, or needs CI/agent artifact configuration./flake-huntRun a flake hunt on a Biloba Vitest suite — run the whole browser suite many times (60 by default), every run to completion with its own JSON report, then read each test's failure rate, the seeds, and the failure evidence out of those reports instead of re-running. Covers the hunt script (vitest run with shuffle and a recorded seed, maxWorkers at the measured knee, no retry or bail, a per-run BILOBA_SCREENSHOTS_DIR, and the seed, wall clock, and exit status the JSON reporter doesn't record), the runs the JSON reports as clean when they aren't (unhandled errors, failed beforeAll hooks, killed runs), logging BilobaError's code and trajectory, what keeps a hunt a valid measurement (one hunt at a time on an idle machine, nothing editing the tree, focused hunts for iterating only, stale visual baselines), how many clean runs it takes to call a flake dead, reading the results (one systemic race behind many names, stalled tabs, a long tail that clusters by run), and the performance record a hunt produces (test timing, the longest file, per-test cost, drift between hunts). Use before declaring a flake fixed, after changing shared test helpers or fixtures, at the end of a batch of work, or to measure a suite's performance.npx claudepluginhub onsi/biloba --plugin biloba-vitestOther plugins' skills for the same job