Biloba for Vitest
Biloba's TypeScript client drives Chrome through bilobad. Each Vitest worker owns a daemon; all daemons attach to one Chrome started by global setup:
vitest worker 1 ──▶ bilobad ──┐
vitest worker 2 ──▶ bilobad ──┼──▶ one shared Chrome
vitest worker 3 ──▶ bilobad ──┘
This preserves parallelism without launching a browser per test file. Each root Session owns an isolated browser context. Reuse it across tests with session.prepare(); open sibling tabs only for flows that need them.
Principles
- Poll next to Chrome. Actions and assertions poll inside the daemon and make one client request. Never wrap them in
expect.poll, waitFor, sleeps, or a retry loop.
- Use the fast path by default. Locator actions are atomic page-runtime operations. Add
.realistic() only for behavior that depends on real pointer/keyboard input, occlusion, hover, scrolling, drag, or touch.
- Assert observable outcomes. Prefer semantic locators, visible state, URL/title, network effects, and application state over styling classes or implementation structure.
- Reuse isolated sessions. A fresh browser per test destroys the topology's performance advantage.
prepare() resets cheaply; root sessions isolate cookies and storage between workers.
- Read structured failures.
BilobaError carries codes, locator/expected/observed values, polling trajectory, outlines, screenshots, and context-wide diagnostics.
Route by task
| Task |
Skill |
| Wire the daemon, shared browser, and Vitest lifecycle |
biloba-vitest:setup |
| Write locators, actions, assertions, tabs, frames, or network tests |
biloba-vitest:write-tests |
| Create or diagnose screenshot baselines |
biloba-vitest:visual-assertions |
| Read a failure, console output, artifacts, or crash code |
biloba-vitest:debug-failures |
| Remove races, order dependence, or redundant polling |
biloba-vitest:flaky-tests |
| Measure failure rates or suite performance across many runs (a flake hunt) |
biloba-vitest:flake-hunt |
Canonical docs: https://onsi.github.io/biloba/vitest.html. npm install -D vitest biloba also pulls in the bilobad daemon via a per-platform package — no Go toolchain needed (macOS/Linux, x64/arm64; Windows isn't supported yet). The package is pre-1.0; pin the plugin and client to the same Biloba version.
1---2name: overview-23description: Explain 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.4---56# Biloba for Vitest78Biloba's TypeScript client drives Chrome through `bilobad`. Each Vitest worker owns a daemon; all daemons attach to one Chrome started by global setup:910```11vitest worker 1 ──▶ bilobad ──┐12vitest worker 2 ──▶ bilobad ──┼──▶ one shared Chrome13vitest worker 3 ──▶ bilobad ──┘14```1516This preserves parallelism without launching a browser per test file. Each root `Session` owns an isolated browser context. Reuse it across tests with `session.prepare()`; open sibling tabs only for flows that need them.1718## Principles1920- **Poll next to Chrome.** Actions and assertions poll inside the daemon and make one client request. Never wrap them in `expect.poll`, `waitFor`, sleeps, or a retry loop.21- **Use the fast path by default.** Locator actions are atomic page-runtime operations. Add `.realistic()` only for behavior that depends on real pointer/keyboard input, occlusion, hover, scrolling, drag, or touch.22- **Assert observable outcomes.** Prefer semantic locators, visible state, URL/title, network effects, and application state over styling classes or implementation structure.23- **Reuse isolated sessions.** A fresh browser per test destroys the topology's performance advantage. `prepare()` resets cheaply; root sessions isolate cookies and storage between workers.24- **Read structured failures.** `BilobaError` carries codes, locator/expected/observed values, polling trajectory, outlines, screenshots, and context-wide diagnostics.2526## Route by task2728| Task | Skill |29|---|---|30| Wire the daemon, shared browser, and Vitest lifecycle | `biloba-vitest:setup` |31| Write locators, actions, assertions, tabs, frames, or network tests | `biloba-vitest:write-tests` |32| Create or diagnose screenshot baselines | `biloba-vitest:visual-assertions` |33| Read a failure, console output, artifacts, or crash code | `biloba-vitest:debug-failures` |34| Remove races, order dependence, or redundant polling | `biloba-vitest:flaky-tests` |35| Measure failure rates or suite performance across many runs (a flake hunt) | `biloba-vitest:flake-hunt` |3637Canonical docs: <https://onsi.github.io/biloba/vitest.html>. `npm install -D vitest biloba` also pulls in the `bilobad` daemon via a per-platform package — no Go toolchain needed (macOS/Linux, x64/arm64; Windows isn't supported yet). The package is pre-1.0; pin the plugin and client to the same Biloba version.