Skip to main content

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​

FileRole
dim.test.global.jsHarness (DimTest.cover registry)
dim.parse.global.jsDimParse — subset JS parser
dim.cover.global.jsInstrumenter + 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​

BucketWhenCI
unitSpecs using DimTest.mount / in-page fixtureOften gated at 100% (?impl=js)
e2eDimTest.open rewrites same-origin notes/** <script src> inside the iframeLogged; 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.