Testing components
@bext-stack/framework/testing is a tiny testing-library over bext's render + hydrate primitives and a happy-dom DOM. Render a signals component, query it, interact, assert — no browser, with bun test.
Tip
The module is never pulled into your bundles (it isn't re-exported from the index — import it only from test files). render() does the SSR then the real hydration, so you test exactly the browser path: a click fires the real handler and the reactive markers update.
Example
import { describe, expect, test } from "bun:test";
import { render } from "@bext-stack/framework/testing";
import Counter from "./Counter";
test("counter increments", () => {
const { text, getByTestId, click } = render(Counter, { start: 5 });
expect(text()).toContain("Count: 5");
click(getByTestId("inc"));
expect(text()).toContain("Count: 6");
});
// render(Component, props) server-renders the signals island, mounts it in a
// happy-dom container, and HYDRATES it — then returns:
// text() whole-container textContent
// getByText(m) deepest element matching a string / RegExp
// getByTestId(id) element by data-testid
// click(el) / type(el, value) / fire(el, event)