Testing and Code Coverage
How this repository is tested, how coverage is measured, and how to read the numbers. This document covers all three components and the sample apps; it is the reference for the test suites themselves, not for any one component's behaviour.
1. Two suites plus a type check, by design
npm test runs all three, type check first. The two suites are complementary,
not redundant:
| Suite | Runner | What it covers | Needs |
|---|---|---|---|
Unit (tests/node/) |
Node's built-in node:test |
Pure logic: data managers, filter model, scheduler, comparators, storage providers, templates, scroll arithmetic | Nothing — no browser, no server |
E2E (tests/playwright/) |
Playwright + Chromium (the chromium project, plus chromium-perf for the performance specs, §2) and Firefox (the firefox-placement / firefox-keyboard / firefox-pointer / firefox-focus / firefox-pictures / firefox-layout / firefox-gantt projects) |
Everything touching the DOM: rendering, virtualization, header menus, resizing, theming, pointer and wheel input | Chromium and Firefox; the static server starts automatically |
Neither suite measures the third check, tests/types/ (npm run test:types):
tsc --noEmit compiling small hand-written .dts-typecheck.ts files against
each component's hand-authored .d.ts. Deliberately not
named *.test.ts / *-test.ts: those suffixes match Node's own --test
discovery glob, and npm run test:unit would then try to execute them —
they use browser globals (document, HTMLElement) with no DOM present and
would fail. It's a compile-time type check, not a coverage-measured suite — a
compile error is the assertion, and nothing in it executes. It complements the
unit suite's tests/node/dts-conformance.test.js, which checks method/property
names match at runtime but can't see a type going stale (e.g. a parameter
widened from string to string | number); the type check catches exactly
that. Extend the matching *.dts-typecheck.ts file when a component's public
API grows.
The split is deliberate. A module full of arithmetic is cheaper and more
precisely testable in Node — a real browser adds nothing to deltaMode handling
or $filter string generation, but makes the branches harder to reach. A module
that manipulates layout is the opposite: asserting it against hand-built DOM
stubs proves the code works against the stubs, which is a weaker guarantee than
the browser test that already exists.
Reading the two percentages
They use different denominators — Node counts its own executable lines, the browser aggregator counts statement-bearing lines derived from V8 byte ranges — so they are not addable and not directly comparable. Judge each module by the better of its two numbers, because a module is well covered if either suite covers it well:
viewport.feature.jsreads ~30 % in the unit suite and 94 % in the browser. It is well covered.odata-data-manager.jsreads ~56 % in the browser and 100 % in the unit suite. It is well covered.
Blending them, or reading one alone, is misleading in both directions.
2. Running the suites
npm install # first time only
npx playwright install chromium firefox # first time only
npm test # all three: type check, then unit, then E2E
npm run test:types # .d.ts type check only (fastest)
npm run test:unit # Node unit suite only (fast)
npm run test:e2e # Playwright suite only
node --test tests/node/dom-scheduler.test.js # one unit file
npx playwright test tests/playwright/autofit.spec.js --no-deps # one spec
npx playwright test --project chromium-perf --no-deps # the performance specs only
node --test tests/node(a bare directory) fails withMODULE_NOT_FOUNDon current Node versions. Usenpm run test:unit(no argument — Node's default discovery findstests/node/*.test.js), a glob, or an explicit file path.
Performance specs run last, one at a time
The specs that assert a wall-clock budget on CPU-heavy work (frame times,
main-thread blocking, per-call latency) are listed in PERF_SPECS in
playwright.config.js and run in their own chromium-perf project. That
project has workers: 1 and depends on every other project, and Playwright
starts a project only once its dependencies have finished, so these specs run
after the rest of the suite with no other worker competing for the CPU.
autofit-performance.spec.js records the effect: ~130 ms alone, ~300 ms under
the full parallel suite. A budget checked in the parallel run measures the
machine's load as much as the component.
Three consequences of the dependency:
- If any test in another project fails, the performance specs are reported as not run.
- A file or
--grepfilter does not narrow a project's dependencies, so a targeted run that matches a performance spec runs the whole suite first. Pass--no-depsto every targeted run; it changes nothing for the others. - A new project must be added to
chromium-perf'sdependencies, or it runs alongside the performance specs.
A spec belongs in PERF_SPECS when it asserts a budget. One whose time bound
only separates two far-apart behaviours (northwind-orders-js-load-more-reload:
no backoff versus the 1 s minimum one) or compares two code paths measured
under the same load (data-loading-shimmer) stays in the parallel run. Instrumented
runs (§4) leave the project out: they are single-worker already, and
chromium then runs every spec they don't exclude.
Only the specs a change reaches
npm run test:affected # type check, unit suite, affected specs
node scripts/run-affected.js --list # print the selection, run nothing
node scripts/run-affected.js --base <ref> # compare with <ref> instead of main
scripts/run-affected.js takes every file that differs between the merge
base with main and the working tree, plus the untracked files (the whole
branch, committed or not), and runs the type check, the unit suite and the
Playwright specs those files can reach. A diagram-only branch runs 29 spec
files of 221.
Specs load the components through page URLs, not imports, so the selection
reads text. The repository is cut into units, each named by markers: a
component (src/vanilla-x/: vanilla-x, vn-x), a sample app
(samples/<app>/: its name), a getting-started page (each file of
samples/_getting-started/: its name), a support file (anything in
tests/playwright/ that isn't a spec: its name) and a spec. A changed file
makes its unit affected, and a unit whose code (.js, .mjs, .css,
.html) holds an affected unit's marker is affected too, until nothing
changes: process-flowchart-js holds vanilla-diagram, _diagram-fixture.js
names the app, and the specs that import the fixture follow. The affected
specs run.
- A component is reached only by a change to its own files. Every page
loads each component it uses by name, so the pages record what depends on
what; a component's own text doesn't (the grid's comments name
<vn-gantt>, the host that embeds it). - Each getting-started page is its own unit.
_diagram-fixture.jsopens one page, so a change to a Gantt page doesn't select the diagram specs. A reference to the folder itself, not followed by/, stands for every page:getting-started-examples.spec.jsreads the folder and loads them all. - Paths no spec can see select nothing:
docs/, Markdown,.d.tsfiles,tests/node/,tests/types/,scripts/,tsconfig.json,eslint.config.js. The type check and the unit suite, which always run, cover what of them is tested. - The full suite runs instead (
npm test) for a changed file outside those units (build.js,playwright.config.js,package.json, a deleted component) and wheneverpeople-cities-jsis affected: it isbaseURL, so specs that navigate to a relative URL open it without naming it. The grid, the grid toolbar, the resize box andsamples/_common/all reach it, and almost every spec depends on the grid anyway.
A marker found in a comment selects a spec that didn't need to run: the
selection errs on the side of running more. The selected performance specs
run after the others in a second Playwright invocation with
--project chromium-perf --no-deps, so they still run last and alone; the
HTML report then holds only that second run, and the terminal output holds
both. Every step runs even when an earlier one fails, and the exit code is the
first failure's. tests/node/run-affected.test.js pins the selection against
this repository's own specs.
Neither script is named
test-*.js: Node's default--testdiscovery runs any file matchingtest-*.js,*-test.js,*_test.jsor*.test.js, sonpm run test:unitwould run the selection again from inside the unit suite.
Test progress
node scripts/run-with-progress.js [--log <file>] -- <command> [args...]
node scripts/run-with-progress.js --log suite.log -- npm test
scripts/run-with-progress.js runs the command, writes its output unchanged to
the log (or to its own output), and reads it as it comes: the phase, each
Playwright run's start and test count, the tests done, the first failure (a
type error, a failed Node test, or a Playwright failure, which the reporter
prints as it happens), and the Node and Playwright counts. It exits with the
command's exit code, and its standard input is closed, so the HTML reporter
never stops to serve the report after a failure. SIGINT, SIGTERM and SIGHUP
are passed on to the command, so closing the terminal still ends the run with
its result written.
It keeps what it read in a status file, .harness-tmp/test-progress.json
under the repository root (it creates the folder), rewritten every 2 s and at
once when a Playwright run starts, at the first failure and at the end. Each
write goes to a temporary file renamed over the status file, so a reader never
sees half a file; a write that fails (a full disk, Windows refusing the rename
while a reader holds the file) is retried at the next tick (the end state a
few times, 200 ms apart) and never changes the run. At the end the file says passed or failed, with the counts and the
exit code, and stays. Its fields (format version 1):
| Field | What it holds |
|---|---|
version |
1: a reader draws nothing for another value. |
command, pid |
The command, and the runner's process id. |
startedAt, updatedAt |
Milliseconds since the epoch. |
state |
running, passed or failed. |
phase |
type check and Node suite, Playwright, Playwright run 2. |
done, total |
Tests done out of the current Playwright run's total; null before one starts. |
leftMs |
A linear estimate of the time left, null until a test is done. The performance specs run last and slower, so the end of a full run takes longer than it says. |
firstFailure |
chromium › x.spec.js:12:5 › title, type check: ..., Node: ..., or null. |
summary, exitCode |
At the end: the counts (Node 312 passed; Playwright 1270 passed, 2 skipped) and the exit code, 127 when the command could not start. |
The harness's tests plugin (Claude Code 2.1.330 or later) reads the file
every 2 s in every Claude Code session open at the repository root, and draws
it as a row above the prompt: a progress bar with the tests done, the time so
far and the time left, the first failure as plain text, then passed or FAILED
with the counts. Drawing starts no model turn, so an agent that started the run
in the background still just waits for it to end. A running status not updated
for 30 s says the run may have stopped; any status last updated over 60
minutes ago draws no row. The plugin's README holds the rest.
The runner also prints, prefixed [run-with-progress], on standard error: the
start, each Playwright run's start, the first failure and the result, which an
agent reads in the background command's output.
Git ignores .harness-tmp/ through the harness's exclude block in
.git/info/exclude, which /instructions:init writes. A clone whose block
predates .harness-tmp/ sees the status file as untracked, and
npm run test:affected can't place it and runs the full suite: re-run
/instructions:init first. Two runs at once in one checkout write the same
file, and the last write wins; they already share Playwright's server and
test-results/, so it isn't a supported case.
Coverage
npm run test:coverage # unit-suite coverage over src/, ~10 s
npm run test:coverage:e2e # browser-side V8 coverage, ~60 min
test:coverage uses Node's --experimental-test-coverage, scoped to src/**
so build.js and the tests themselves stay out of the denominator. It enforces
thresholds (§5) and exits non-zero below them.
It reports only files a test actually loads — a source file no unit test
requires is absent from the table rather than shown as 0 %.
tests/node/dts-conformance.test.js loads every component source precisely so
nothing can hide from the report.
test:coverage:e2e re-runs the Playwright suite with PW_COVERAGE=1,
collecting Chromium's V8 coverage per test via the fixture in
tests/playwright/fixtures.js, then aggregates the per-test captures with
scripts/aggregate-coverage.js into a table plus
coverage/e2e-summary.json (which carries per-file uncovered line numbers —
useful when you want to know which lines are missing, not just how many).
Writing a spec: import
test/expectfrom./fixtures.js, not from@playwright/test. The fixture re-exports both and adds the opt-in coverage collector; a spec importing@playwright/testdirectly still runs but contributes nothing to the coverage table.
3. Current measurement
Measured 2026-11-25 on Node v25.9.0 / Playwright 1.59.1 / Chromium.
| Suite | Coverage | Tests | Runtime |
|---|---|---|---|
| Unit | 68.90 % lines · 82.89 % branches · 55.22 % functions | 2114 in 214 suites | 8.8 s |
| Browser | 91.59 % statement lines (29,147 / 31,823) | 2185 total; 2124 instrumented | 59.7 min |
The instrumented run was green: 2121 passed, 3 skipped.
The unit line and function figures are lower than in earlier measurements because the Gantt and diagram modules joined the denominator: their DOM-bound code is tested in the browser (§6).
The browser total is not exact to the decimal. Across five green runs of an earlier tree it landed between 80.23 % and 80.32 % — a spread of about ±0.05 pt, because a few timing-dependent paths (rAF-deferred renders, idle timers) are hit in some runs and not others. Treat a sub-0.1 pt change as noise. Per-module figures are stable to the decimal.
By module, ranked by the better suite
| Module | LOC | Unit line % | Unit func % | Browser line % | Best |
|---|---|---|---|---|---|
vanilla-grid/features/columns-reorder.feature.js |
428 | 34.78 | 23.53 | 71.50 | 71.50 |
vanilla-gantt-toolbar/vanilla-gantt-toolbar.js |
85 | 52.57 | 9.09 | 82.35 | 82.35 |
vanilla-grid/features/columns-freeze.feature.js |
312 | 56.50 | 79.17 | 83.33 | 83.33 |
vanilla-gantt/vanilla-gantt.js |
279 | 44.28 | 9.38 | 84.23 | 84.23 |
vanilla-grid/main-thread-yield.js |
35 | 85.45 | 66.67 | 34.29 | 85.45 |
vanilla-grid/vanilla-grid-element.js |
1439 | 63.62 | 29.56 | 88.05 | 88.05 |
vanilla-grid/features/columns-resize.feature.js |
865 | 19.81 | 35.14 | 88.32 | 88.32 |
vanilla-grid/features/interaction.feature.js |
492 | 72.94 | 68.29 | 88.82 | 88.82 |
vanilla-grid/vanilla-grid.js |
2506 | 83.04 | 61.54 | 88.83 | 88.83 |
vanilla-grid/features/persistence.feature.js |
580 | 89.97 | 80.68 | 85.17 | 89.97 |
vanilla-grid/features/header-menu-submenu.feature.js |
142 | 44.23 | 42.86 | 90.14 | 90.14 |
vanilla-grid/features/header-menu.feature.js |
576 | 21.92 | 12.50 | 90.80 | 90.80 |
vanilla-grid/features/excel-export.feature.js |
592 | 86.80 | 86.21 | 91.22 | 91.22 |
vanilla-grid/features/columns-visibility.feature.js |
188 | 75.00 | 91.30 | 91.49 | 91.49 |
vanilla-grid/intl-cache.js |
20 | 91.80 | 100.00 | 85.00 | 91.80 |
vanilla-grid/features/stretch-to-fit.feature.js |
216 | 89.22 | 90.91 | 92.13 | 92.13 |
vanilla-diagram/vanilla-diagram-palette.js |
377 | 27.32 | 0.00 | 92.57 | 92.57 |
vanilla-diagram/features/clipboard.feature.js |
213 | 67.85 | 60.00 | 92.96 | 92.96 |
vanilla-grid/features/sorting-worker.feature.js |
279 | 93.02 | 95.00 | 84.59 | 93.02 |
vanilla-gantt/vanilla-gantt-element.js |
533 | 31.05 | 2.94 | 93.06 | 93.06 |
vanilla-diagram/features/viewport.feature.js |
130 | 46.61 | 5.00 | 93.08 | 93.08 |
vanilla-grid/data-managers/graphql-data-manager.js |
393 | 93.43 | 72.00 | 67.43 | 93.43 |
vanilla-grid/storage/grid-storage-provider.js |
86 | 94.12 | 62.50 | 70.93 | 94.12 |
vanilla-grid/features/interaction-keyboard.feature.js |
142 | 69.51 | 83.33 | 94.37 | 94.37 |
vanilla-grid/features/sorting.feature.js |
434 | 94.37 | 98.36 | 86.18 | 94.37 |
vanilla-diagram-toolbar/vanilla-diagram-toolbar.js |
950 | 39.53 | 2.56 | 94.42 | 94.42 |
vanilla-grid/column-key.js |
12 | 94.59 | 100.00 | 83.33 | 94.59 |
vanilla-diagram/features/text-editing.feature.js |
93 | 39.60 | 12.50 | 94.62 | 94.62 |
vanilla-diagram/vanilla-diagram-element.js |
583 | 38.67 | 3.57 | 94.68 | 94.68 |
vanilla-diagram/vanilla-diagram.js |
1071 | 33.15 | 5.05 | 94.96 | 94.96 |
vanilla-grid/data-managers/data-manager.js |
38 | 95.11 | 55.56 | 68.42 | 95.11 |
vanilla-grid-toolbar/vanilla-grid-toolbar.js |
1330 | 56.48 | 23.70 | 95.19 | 95.19 |
vanilla-gantt/features/dependencies.feature.js |
335 | 78.79 | 71.43 | 95.22 | 95.22 |
vanilla-grid/features/grouping-bar.feature.js |
365 | 40.63 | 3.70 | 95.34 | 95.34 |
vanilla-diagram/features/geometry.feature.js |
335 | 95.57 | 90.63 | 86.87 | 95.57 |
vanilla-grid/features/excel-export-worker.feature.js |
546 | 83.29 | 30.00 | 95.60 | 95.60 |
vanilla-grid/shimmer-threshold.js |
16 | 96.00 | 100.00 | 87.50 | 96.00 |
vanilla-grid/features/columns.feature.js |
302 | 91.72 | 59.52 | 96.03 | 96.03 |
vanilla-resize-box/vanilla-resize-box.js |
336 | 96.21 | 91.30 | 95.54 | 96.21 |
vanilla-gantt/features/scheduling.feature.js |
133 | 96.35 | 80.00 | 90.98 | 96.35 |
vanilla-grid/features/tree.feature.js |
502 | 96.42 | 86.27 | 92.43 | 96.42 |
vanilla-grid/dom-scheduler.js |
54 | 96.55 | 100.00 | 90.74 | 96.55 |
vanilla-diagram/features/routing.feature.js |
186 | 96.70 | 92.31 | 90.32 | 96.70 |
vanilla-grid/features/excel-export-delivery.feature.js |
158 | 96.83 | 95.65 | 91.14 | 96.83 |
vanilla-grid/templates.js |
55 | 96.85 | 100.00 | 90.91 | 96.85 |
vanilla-grid/features/viewport.feature.js |
585 | 58.71 | 54.72 | 96.92 | 96.92 |
vanilla-diagram/features/model.feature.js |
377 | 96.97 | 90.32 | 94.43 | 96.97 |
vanilla-grid/data-managers/static-data-manager.js |
1386 | 97.04 | 83.53 | 89.03 | 97.04 |
vanilla-diagram/features/symbols.feature.js |
174 | 97.05 | 100.00 | 94.25 | 97.05 |
vanilla-grid/features/interaction-pointer.feature.js |
106 | 25.00 | 40.00 | 97.17 | 97.17 |
vanilla-grid/features/selection.feature.js |
434 | 97.23 | 96.67 | 86.41 | 97.23 |
vanilla-grid/features/rendering.feature.js |
1356 | 55.64 | 46.08 | 97.35 | 97.35 |
vanilla-grid-toolbar/vanilla-grid-toolbar-events.js |
13 | 97.37 | 100.00 | 84.62 | 97.37 |
vanilla-diagram/features/accessibility.feature.js |
341 | 31.85 | 3.23 | 97.65 | 97.65 |
vanilla-gantt/features/rendering.feature.js |
261 | 32.64 | 5.00 | 98.08 | 98.08 |
vanilla-gantt/features/timeline-scale.feature.js |
142 | 98.13 | 95.65 | 97.18 | 98.13 |
vanilla-grid/features/datetime.feature.js |
272 | 98.13 | 100.00 | 80.15 | 98.13 |
vanilla-gantt/vanilla-gantt-events.js |
19 | 98.26 | 100.00 | 89.47 | 98.26 |
vanilla-gantt/features/task-move.feature.js |
432 | 34.39 | 2.86 | 98.38 | 98.38 |
vanilla-diagram/features/keyboard.feature.js |
258 | 31.09 | 6.25 | 98.45 | 98.45 |
vanilla-gantt/features/tasks.feature.js |
194 | 98.47 | 100.00 | 95.88 | 98.47 |
vanilla-grid/features/sorting-comparator.feature.js |
191 | 98.70 | 92.86 | 91.10 | 98.70 |
vanilla-diagram/vanilla-diagram-events.js |
27 | 98.76 | 100.00 | 92.59 | 98.76 |
vanilla-grid/features/grouping.feature.js |
1086 | 98.78 | 97.06 | 91.62 | 98.78 |
vanilla-diagram/features/rendering.feature.js |
1289 | 25.69 | 1.30 | 98.84 | 98.84 |
vanilla-grid/filter-model.js |
145 | 98.86 | 95.65 | 95.17 | 98.86 |
vanilla-diagram/features/interaction.feature.js |
720 | 27.43 | 1.92 | 98.89 | 98.89 |
vanilla-grid/data-managers/odata-data-manager.js |
567 | 98.92 | 100.00 | 71.08 | 98.92 |
vanilla-diagram/features/spatial-index.feature.js |
140 | 99.10 | 94.12 | 92.86 | 99.10 |
vanilla-gantt/features/scroll-sync.feature.js |
248 | 36.28 | 5.56 | 99.19 | 99.19 |
vanilla-diagram/features/save-queue.feature.js |
73 | 99.21 | 88.24 | 98.63 | 99.21 |
vanilla-diagram/features/snapping.feature.js |
163 | 97.53 | 100.00 | 99.39 | 99.39 |
vanilla-diagram/features/export.feature.js |
372 | 25.98 | 7.69 | 99.46 | 99.46 |
vanilla-grid/grid-events.js |
34 | 99.48 | 100.00 | 94.12 | 99.48 |
vanilla-diagram/features/orthogonal-router.feature.js |
269 | 99.53 | 97.06 | 98.51 | 99.53 |
vanilla-grid/aggregate-registry.js |
205 | 99.55 | 100.00 | 92.68 | 99.55 |
vanilla-diagram/features/commands.feature.js |
164 | 99.61 | 100.00 | 96.95 | 99.61 |
vanilla-diagram/data-managers/diagram-data-manager.js |
15 | 100.00 | 100.00 | 46.67 | 100.00 |
vanilla-diagram/data-managers/static-diagram-data-manager.js |
65 | 100.00 | 100.00 | 81.54 | 100.00 |
vanilla-diagram/features/groups.feature.js |
84 | 48.05 | 12.50 | 100.00 | 100.00 |
vanilla-diagram/features/layout.feature.js |
550 | 100.00 | 98.85 | 98.73 | 100.00 |
vanilla-gantt/data-managers/gantt-data-manager.js |
15 | 100.00 | 100.00 | 66.67 | 100.00 |
vanilla-gantt/data-managers/static-gantt-data-manager.js |
47 | 100.00 | 100.00 | 97.87 | 100.00 |
vanilla-gantt/features/scrollbar.feature.js |
96 | 35.97 | 11.11 | 100.00 | 100.00 |
vanilla-gantt/features/splitter.feature.js |
126 | 42.18 | 7.69 | 100.00 | 100.00 |
vanilla-grid/column-access.js |
40 | 100.00 | 100.00 | 92.50 | 100.00 |
LOC is statement-bearing lines as counted by the browser aggregator. A dash in a unit column means no unit test loads that file.
No module sits below 70 % in its better suite. The lowest is
columns-reorder.feature.js at 71.50 %.
4. What the instrumented run deliberately excludes
playwright.config.js defines INSTRUMENTATION_SENSITIVE_SPECS, applied via
testIgnore only when PW_COVERAGE=1. Two groups, for two different reasons.
Both are skipped, not weakened, and both run in full on every ordinary
npm run test:e2e.
Timing-sensitive specs
scrolling-performance, scrolling-performance-grouped,
autofit-performance, search-warm-latency, search-worker-performance,
grouping-toggle-performance, excel-export-large,
selection-select-all-performance, gantt-scroll-performance,
diagram-performance.
Collecting V8 coverage slows the page enough to break their frame-budget and slice-latency assertions. Coverage collection perturbs the very thing they measure, so they are permanently outside the coverage picture — running them instrumented fails reliably even with no parallel contention.
The consequence is worth internalising: for any behaviour those specs own,
coverage can only be earned by re-testing it in a form that can be measured.
wheel-input.spec.js exists for exactly that reason — it asserts the wheel
state machine on a small dataset with no timing claims, so it runs inside the
measured suite, while scrolling-performance.spec.js keeps the timing claim
outside it.
A spec that only waits for the next frame is not timing-sensitive.
touch-momentum-sync-render.spec.js polls for the deferred render instead of
sleeping a fixed time, so it runs inside the measured suite and covers the
grid's touch handler, which no other spec reaches.
Live network specs
northwind-orders-js-smoke and northwind-customers-js-smoke (Northwind
OData), github-repos-js-smoke (GitHub
Search), wikipedia-pages-js-smoke (MediaWiki), people-cities-js-smoke (MINT,
this project's own hosted BFF), plus late-children-framework-integration
(GitHub Search) and sample-search-box, which intercepts Northwind requests to
assert the $filter URL but lets them continue to the wire.
These let a real service respond, so their result depends on a service's
availability and quota. The first two are someone else's infrastructure; MINT
(people-cities-app.mthome.org) is the project's own, which makes it the one outage that
would be self-inflicted — the trade accepted for having any end-to-end check
that people-cities-js still works against a real backend, since its other 50
specs block the BFF entirely. GitHub's unauthenticated Search API is the binding
constraint:
| Observation | Value |
|---|---|
| Live search requests per page load | 1 (/search/repositories) |
| Rate limit | x-ratelimit-limit: 10, x-ratelimit-resource: search — 10 per minute |
| Consumption across three sequential loads | remaining: 9 → 8 → 7 |
One suite run makes 3–5 such requests and fits inside the budget. Repeated or
overlapping runs do not — and measuring coverage several times in a row is
exactly that. Sampling the limit at a single moment shows a healthy 200, which
is why this is easy to misdiagnose as a component regression.
Excluding them costs almost nothing: each is a thin smoke test, or asserts only
the request URL, over modules many other specs exercise.
odata-data-manager.js's browser figure is unchanged either way.
A spec that merely needs rows on screen does not belong in this group — it
should stub the backend. search-term-persistence, filter-panel-localization
and theme-applies-on-load used to fetch Northwind purely to populate the grid,
then assert something unrelated to the data (persistence round-trip, i18n
labels, rendered theme). That made them fail on a third party's latency:
Northwind's tail runs past 5s under ten concurrent queries, and combined with
full-suite worker contention it pushed search-term-persistence's 30s row wait
past its timeout — a failure that never reproduced in isolation (32/32 passes at
--repeat-each=4). They now use _northwind-stub.js, which serves canned rows
honouring $top / $skip and the contains() disjunction the grid emits in
searchMode: 'filter'. No assertion was weakened, and the three specs went from
~8–18s each to ~2s.
Why the instrumented run is single-worker
scripts/run-e2e-coverage.js passes --workers=1. A few specs assert on a race
— a host-set toolbar status message versus an error status — and lose it when
instrumentation overhead is compounded by parallel workers competing for CPU.
They pass instrumented in isolation, so the fix is to remove the contention
rather than to loosen timeouts that are correct for the ordinary run.
Note that serialising does not help the rate-limited specs above, and slightly hurts: run in parallel their requests are interleaved with unrelated specs and spread out in time; run serially they execute back-to-back, packing every request into one short window. That is why both mechanisms are needed.
5. Thresholds and the ratchet
npm run test:coverage enforces unit thresholds, and CI runs it on every push
and pull request (.github/workflows/ci.yml: lint, test:types,
test:coverage, build). The Playwright suite is not run in CI — it needs a
Chromium download and several minutes. Run it locally before merging.
| Metric | Threshold | Current |
|---|---|---|
| lines | 63 | 68.90 |
| branches | 75 | 82.89 |
| functions | 53 | 55.22 |
They sit under the current numbers so they ratchet upward rather than blocking ordinary work (the function margin is down to about 2 pt since the Gantt and diagram modules joined the denominator). Raise them when coverage improves; never lower them to make a red build green.
6. Where the remaining gap is — and why most of it should stay
Ranked by absolute uncovered unit lines:
| Module | Uncovered unit lines | Unit line % | Browser line % |
|---|---|---|---|
vanilla-diagram/features/rendering.feature.js |
1,417 | 25.69 | 98.84 |
vanilla-grid/features/rendering.feature.js |
1,305 | 55.64 | 97.35 |
vanilla-grid/features/columns-resize.feature.js |
1,247 | 19.81 | 88.32 |
vanilla-grid/vanilla-grid-element.js |
1,186 | 63.62 | 88.05 |
vanilla-grid-toolbar/vanilla-grid-toolbar.js |
1,159 | 56.48 | 95.19 |
vanilla-diagram/vanilla-diagram.js |
1,095 | 33.15 | 94.96 |
vanilla-diagram-toolbar/vanilla-diagram-toolbar.js |
878 | 39.53 | 94.42 |
vanilla-grid/vanilla-grid.js |
873 | 83.04 | 88.83 |
That is about half of all uncovered unit lines (48.7 %), and every one of those
modules is covered at 88–99 % by the browser suite. Covering them in Node would mean
building elaborate DOM stubs and then asserting the code behaves correctly
against those stubs — expensive, brittle, and a weaker guarantee than the
browser test that already exists. The same argument disposes of the low unit
function percentages (vanilla-diagram-palette.js 0.00 %, the diagram's
rendering.feature.js 1.30 %, vanilla-diagram-toolbar.js 2.56 %): those
methods are called from a browser, and that is where they are tested.
Genuinely thin in both suites, in priority order:
features/columns-reorder.feature.js— 34.78 unit / 71.50 browser. The repo's lowest better-suite figure and the only module under 80 %.features/columns-resize.feature.js— 19.81 unit / 88.32 browser. The browser number is healthy; the unit number is the lowest in the repo.main-thread-yield.js(34.29 browser),storage/grid-storage-provider.js(70.93 browser) anddata-managers/odata-data-manager.js(71.08 browser) look alarming in the browser table but are 85.45 %, 94.12 % and 98.92 % in the unit suite. Well covered — no action.
Not planned, deliberately: running the whole suite in a second browser (the
Firefox projects cover only the specs where the engines diverge, see
playwright.config.js), any third-party coverage stack, and restructuring the
existing suites.
7. Practical guidance
Chase branches, not just lines. A module can read ~97 % on lines and still
hide real gaps: odata-data-manager.js sat at 96.79 % lines / 83.33 % branches,
and the missing branches were per-operator $filter serialization — where a
mistake does not throw, it silently returns the wrong rows.
A green test is not evidence it tested anything. During this work a
count-failure test asserted the right value and passed, but reached it through
an early return (if (!this._countUrl)) and never executed the branch it named.
Only the coverage data exposed it. When you add a test for a specific branch,
confirm the branch's line count actually moved.
Use coverage/e2e-summary.json to find the gap. It carries per-file
uncoveredLines, so you can target the largest coherent block instead of
guessing which behaviour is missing.
Don't edit src/ while test:coverage:e2e runs. The suite serves the live
files, so an edit that shifts a file's bytes leaves captures from before and
after it at different offsets, and the aggregator reads them all against one
copy of the source: uncovered lines past the edit count as covered. A 21-byte
comment edit once lifted vanilla-grid-element.js from 88.05 % to 92.08 %.
Re-run after editing.
Hunt flakes with --workers=1. High --repeat-each with parallel workers
overwhelms the static file server the suite starts on port 4173; the resulting
net::ERR_CONNECTION_REFUSED failures look alarming and say nothing about the
components.
Never sleep in a unit test. Use waitFor(predicate) from
tests/node/_helpers.js. A fixed setTimeout ties the result to machine speed,
and the suite runs its files concurrently — that is how the one historical flake
in this suite happened.
Poll boot-time state in a spec. bootGrid blocks the BFF with
page.route(...).abort(), which intercepts inside the browser before the
network — so whether a backend is actually listening on port 3000 is irrelevant,
and the app's boot fetch always fails. Components therefore transiently show
an error state before injected rows clear it. Any assertion about that state
must be polled (Playwright's expect.poll / auto-retrying assertions), never
sampled once.
Assert proportion, not pixels, for pointer drags. Thumb geometry depends on
the theme's row height and the runner's window size. Assert direction and
proportional movement, as column-resizing.spec.js and custom-scrollbar.spec.js
do, and verify every new spec under --repeat-each=3 — instrumented as well as
not, since coverage overhead widens every render race.
8. Test layout
tests/
types/ # tsc --noEmit smoke tests (npm run test:types)
*.dts-typecheck.ts
playwright/ # Playwright E2E specs (npm run test:e2e)
fixtures.js # test/expect re-export + PW_COVERAGE fixture
_helpers.js # shared boot/row-injection helpers
*.spec.js
node/ # Node built-in (node:test) unit suite
_helpers.js # shared helpers (waitFor)
dts-conformance.test.js # runtime name check of the .d.ts files
docs-front-matter.test.js # docs/ front matter: format, tags, paths, related links
*.test.js
scripts/
run-e2e-coverage.js # runs the E2E suite with coverage enabled
aggregate-coverage.js # aggregates browser V8 coverage into a table
record-test.ps1 # PowerShell recording helper
run-affected.js # runs only the tests a branch's changes reach
run-with-progress.js # runs a test command, keeping a status file of its progress
playwright.config.js # Playwright configuration + spec exclusions
tsconfig.json # tsc config for tests/types/
playwright.config.js starts a static server on port 4173 for the whole repo
root, so every sample app is reachable; baseURL points relative navigations at
people-cities-js, and specs targeting other apps use an absolute path.