@opentf/afw-test

A testing utility for AFW, inspired by Testing Library. It renders components into esdev's native DOM realm or a real browser. The esdev plugin compiles JSX, and the package provides @testing-library/dom queries plus user-event.

Shell
pnpm add -D @opentf/afw-test

Why it fits AFW

  • 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-event you 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 "runtime:test";
import { render } from "@opentf/afw-test";
import Counter from "./Counter.jsx";

test("increments on click", async () => {
  const { getByRole } = render(Counter);
  getByRole("button").click();
  expect(getByRole("button").textContent).toBe("Count: 1");
});

The API Reference lists every export.

Last updated on
Edit this page