@opentf/web-test
A testing utility for OTF Web, inspired by Testing Library. It renders components into a real DOM (happy-dom), compiles JSX through the framework's own compiler, and bundles @testing-library/dom queries plus user-event.
Shell
bun add -d @opentf/web-test
Why it fits OTF Web
Real DOM, real compiler. Components run exactly as they ship — no mock renderer.
Signals, not snapshots. Updates are surgical, so you assert on the DOM after an interaction with no
act()wrapper or manual flush.Familiar API. The Testing Library queries and
user-eventyou already know.
Start here
New to it? Follow the path: Setup → Writing Tests → Queries → User Events → Testing Strategies.
At a glance
JSX
import { test, expect } from "bun:test"; import { render, userEvent } from "@opentf/web-test"; import Counter from "./Counter.jsx"; test("increments on click", async () => { const { getByRole } = render(Counter); const user = userEvent.setup(); await user.click(getByRole("button")); expect(getByRole("button").textContent).toBe("Count: 1"); });
The API Reference lists every export.