mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Phase 2 (b)-lite, slice 1: establish a thin DOM test lane so the upcoming virtualized scroll rewrite ships with automated coverage, not just manual checks. The repo's test runner is `node --test` over `*.test.mjs` with no jsdom and no JSX transform, so component rendering wasn't testable. This adds a second lane that coexists with the existing pure-logic lane: - esbuild `load` hook transforms .ts/.tsx (TS + JSX, automatic React runtime) - global-jsdom installs DOM globals via `--import` - @testing-library/react + /dom for render/query - `pnpm test` now runs both lanes (test:unit + test:dom) - DOM tests are `*.dom.test.tsx` Deliberately thin: jsdom has no layout engine, so it does not cover react-virtual's real measurement/scroll math — those stay on the manual/visual verification pass (see FEASIBILITY.md). One smoke test proves the net is wired. Co-authored-by: Taylor Ho <taylorkmho@gmail.com> Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
16 lines
678 B
JavaScript
16 lines
678 B
JavaScript
// DOM test bootstrap for the (b)-lite net. Imported via `--import` so it runs
|
|
// before any test module loads:
|
|
// 1. install a jsdom `window`/`document`/etc. into globalThis (global-jsdom)
|
|
// 2. register the JSX/TSX-transforming module loader
|
|
//
|
|
// Scope is deliberately thin: just enough DOM to render React components and
|
|
// exercise the virtualized scroll path. jsdom has no layout engine, so it does
|
|
// NOT cover react-virtual's real measurement/scroll math — those stay on the
|
|
// manual/visual verification pass. See FEASIBILITY.md.
|
|
|
|
import "global-jsdom/register";
|
|
|
|
import { register } from "node:module";
|
|
|
|
register("./test-dom-loader-hooks.mjs", import.meta.url);
|