/biloba-vitest:debug-failuresfrom biloba-vitest
Diagnoses Biloba Vitest test failures using BilobaError codes, polling trajectories, DOM outlines, screenshots, and crash distinctions. Use when a Biloba test fails, hangs, flakes, or needs CI artifact configuration.
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.
Start with the rejected BilobaError, not a wider timeout:
try {
await session.locator("#never").expectText("ready", {timeoutMs: 500});
} catch (error) {
const failure = error as BilobaError;
console.error(failure.code, failure.locator, failure.expected);
console.error(failure.trajectory, failure.domOutline, failure.artifactPaths);
}
The trajectory tells you what the daemon observed on every attempt. A flat trajectory is usually a stable product/test bug; a monotone approach suggests latency; a match followed by failures points to a detached or replaced node. Widen a timeout only when the evidence shows genuine slow progress.
A timeout whose message ends This tab's page clock is paused at <t>; timers and animation frames won't run until you call runFor, fastForward, or resume. comes from the test's own installClock/pauseAt: the page's timers never ran, so the trajectory is flat. Advance the clock before asserting (biloba-vitest:flaky-tests).
| Code | Meaning |
|---|---|
TIMEOUT | A polling action or assertion exhausted its deadline. The ordinary assertion failure. |
TARGET_NOT_FOUND | No element matched the locator. |
TARGET_NOT_READY | The element exists but is hidden, disabled, or otherwise not actionable yet. A retry may succeed. |
NAVIGATION | The response status did not match the requested navigation status. Waiting will not fix it; use navigateWithStatus when the error page is the page under test. |
JAVASCRIPT_ERROR | Page evaluation threw. |
INVALID_ARGUMENT | The request itself is malformed (e.g. a cookie with no domain and no navigated origin). |
PAGE_CRASHED | This session's renderer died; the browser is fine. Navigate again to recover. Chrome can take several seconds to announce a crash on Linux, and a call in that window fails with a different code; navigate after PAGE_CRASHED, not before, since a navigation sent before the announcement may leave the session dead. |
BROWSER_GONE | The shared Chrome exited or crashed. |
DRIVER_CLOSED | This worker's daemon died; inspect daemonDetail and stderr. |
The crash codes exist because Chrome just stops answering calls to a dead renderer or browser; without them a crash would read as an assertion that never came true. Do not turn crash codes into assertion timeouts. They identify which layer died and whether recovery is possible.
These happen before any test runs, so look at the error text, not BilobaError.code:
resolveDaemonExecutable throws when the per-platform bilobad package (biloba-darwin-arm64, etc.) isn't installed. The message names likely causes: an --omit=optional/--no-optional install, or node_modules built on a different OS/arch than it's running on (a lockfile from macOS reused in a Linux container, say). Reinstall with optional dependencies, or set daemonExecutable/BILOBA_DAEMON_EXECUTABLE.chrome-headless-shell was given explicitly (chromePath, BILOBA_CHROME_HEADLESS_SHELL), on PATH, or cached. The error names npx biloba install-chrome as the fix.bilobad auto-adds --no-sandbox in a headless mode when it's running as root or AppArmor is restricting unprivileged user namespaces (the default on Ubuntu 23.10+, including ubuntu-latest), so this should only happen with chromeSandbox: true forcing the sandbox on. Drop that override, or set chromeSandbox: false to force it off yourself.BILOBA_VERSION_MISMATCH — a process.emitWarning, not a thrown error, raised by connect when an overridden daemon's version doesn't match the biloba package's. It means the two were mixed by accident (an old BILOBA_DAEMON_EXECUTABLE after an upgrade, say); it doesn't fail the run.Install installBilobaVitestHooks from biloba/vitest in a Vitest setup file. It captures live tabs after failures, can capture slow-test progress, replays the page's console errors and page errors ([browser pageerror] Uncaught Error: boom (url:line:column), one-based), and reports console.assert at the test boundary.
session.captureDiagnostics() for an explicit context-wide snapshot.consoleMessages()/onConsoleMessage(), pageErrors()/onPageError(), and warnings()/onWarning() for history and live events; expectPageError(expected) waits for an uncaught exception or unhandled rejection.consoleMessages() also holds the messages Chrome logs itself (a failed resource load, an intervention, a violation), marked by a non-empty source. They are not replayed by the hooks; look there when a resource failed to load. The line/column fields of page errors and stack frames are zero-based, as Chrome reports them.status and failure (net::ERR_...) say how it ended; requests({failed: true}) lists the ones that failed.expectNetworkIdle() names each request still in flight (method, URL, resource type, age). The one that never finishes is usually a long poll, a stream, or a request the app abandoned. A request of a page that has navigated away no longer counts.debugLog to connect for bounded structured daemon/CDP records.diagnostics.scrollIntoView(): the call returns once the page has scrolled, but the page's scroll handlers run in its next frame, and under load Chrome can hold a tab to about one frame a second. Wait on what the page does in response, with a timeout that allows for a second or more.(hover: …) and (pointer: …) from the machine's input devices, and a CI runner with no mouse can report (hover: none). Media emulation can't change them. Pin a mouse at launch with startSharedBrowser({chromeArgs: ["--blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4"]}), and test the no-hover layout with setDeviceMetrics({..., touch: true}).Preventing recurrence → biloba-vitest:flaky-tests. Visual mismatch details → biloba-vitest:visual-assertions. Docs: https://onsi.github.io/biloba/vitest.html#when-something-fails.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub onsi/biloba --plugin biloba-vitest7 skills in this plugin
/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./flaky-testsDiagnose and prevent flaky Biloba TypeScript/Vitest tests — redundant client-side retry loops, immediate mode, single-shot evaluate reads, optimistic UI, async layout, first-match-wins network handlers, held responses, vacuous assertions, visual update/tolerance hazards, lifecycle leakage, never waiting out a clock for a fact you can observe (durations clustered at one timer's period give it away), and timer-driven UI (debounces, countdowns, expiries) taken off real time with the page clock, including why polling never advances a paused clock. Use when a Biloba Vitest test is intermittent, order-dependent, load-sensitive, or only fails in CI/parallel workers./overviewExplain Biloba's TypeScript/Vitest mental model — one shared Chrome, one bilobad process per Vitest worker, isolated reusable root sessions, server-side polling, fast versus realistic input, and structured diagnostics. Use first when adopting biloba or deciding how to structure a Vitest browser suite. Route to the other biloba-vitest:* skills./setupWire Biloba's TypeScript client into Vitest — install biloba and its platform package, install chrome-headless-shell, start one shared Chrome in global setup, provide its connection to workers, create one daemon and reusable root Session per test file, prepare between tests, close cleanly, and choose launch modes/options. Use when installing biloba or changing suite-level browser/daemon lifecycle./visual-assertionsCreate and maintain Biloba screenshot assertions in TypeScript/Vitest — page and locator captures, committed baselines, update mode, masks, pixel and channel tolerances, animation freezing, light/dark schemes, diff artifacts, and structured visual diagnosis. Use when adding expectScreenshot(), reviewing baselines, or diagnosing a visual mismatch./write-testsAuthor Biloba browser tests in TypeScript/Vitest — sessions, tabs, frames, CSS/semantic/XPath locators, polling actions and assertions, realistic input, cookies/storage, dialogs/downloads/network, time-dependent UI with the page clock (installClock + pauseAt/runFor/fastForward), screenshots, and structured failures. Use when writing or reviewing tests against biloba. For wiring the daemon and shared Chrome, use biloba-vitest:setup.Other plugins' skills for the same job