Coverage
DimTest can collect line coverage in the browser with a first-party instrumenter — no Acorn, no app transpile. Production sources on disk are never rewritten.
CDN pieces
| File | Role |
|---|---|
dim.test.global.js | Harness (DimTest.cover registry) |
dim.parse.global.js | DimParse — subset JS parser |
dim.cover.global.js | Instrumenter + embedded DimParse (DimTest.instrument) |
runTests.html fetches each app source (e.g. notes/**/*.js), instruments executable lines, and shows a Coverage block: overall %, per-file hit/total, uncovered ranges.
Excluded from instrumentation: Dim itself, runtime.js, dimui CDN scripts, and *.test.js.
Unit vs e2e buckets
| Bucket | When | CI |
|---|---|---|
| unit | Specs using DimTest.mount / in-page fixture | Often gated at 100% (?impl=js) |
| e2e | DimTest.open rewrites same-origin notes/** <script src> inside the iframe | Logged; not usually CI-gated |
DimTest.cover.register(file, lines);
DimTest.cover.hit(file, line);
DimTest.cover.summary(); // or summary("e2e")
Local harness iteration
While changing DimParse / cover in the dim repo, serve dim/Frontend and point the app at it:
# Terminal A — dim Pages tree
python3 -m http.server 8765 --directory /path/to/dim/Frontend
# Terminal B — app
python3 -m http.server 4173
# Open:
# http://127.0.0.1:4173/runTests.html?dimLib=http://127.0.0.1:8765/lib/
npm run build:pages-lib in dim publishes harness, parser, and cover into Frontend/lib/ for GitHub Pages.