Nothing measured what the tests reach. scripts/coverage.sh runs the cargo tests under cargo-llvm-cov in the ipx-coverage image (Dockerfile.coverage, built by build-image.sh coverage), in a container held to the image builder's 6 GB and six threads, one crate at a time, with the same room and load checks: an instrumented build rebuilds every dependency, the kind of build that took Tower down on 2026-11-04. The first run stayed under load 8 with 11 GB free; 69% of lines. web.rs and daemon.rs read low because the browser suite drives them against a daemon that is not instrumented. npm run coverage:page runs the browser suite on a build of the page (IPX_COVERAGE=1) whose script keeps a source map to each web/src file: web/concat-map.mts maps the joined files line by line and swc takes it as its input map. Each test's page records V8's coverage (tests/ui/coverage.ts, which the specs now take test and expect from), and monocart-coverage-reports writes it file by file: 73% of lines. build.mjs requires the map helper only for that build, since Dockerfile.web's Node does not run TypeScript, and not with a top-level await, which stopped the CommonJS tests requiring build.mjs. The offline tests move to offline.spec.ts, in TypeScript, and stand alone (they add their feed and set the read state they need), with what #391 found untested: another account signing in clears what was kept, a position saved offline waits and is sent, and pictures past the budget go oldest first (keepPictures takes the budget, and trims whether or not anything new came). The fixture JPEGs were a few bytes no browser could draw; they are real now, and the artwork test checks one draws. tsconfig.tools.json type-checks the tests' and build's TypeScript, in npm run typecheck. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
16
CLAUDE.md
16
CLAUDE.md
@@ -188,13 +188,15 @@ cargo clippy --workspace --all-targets -- -D warnings # no warnings, ever
|
||||
cargo deny check # known vulnerabilities, licences, sources (deny.toml); reads Cargo.lock, builds nothing
|
||||
cargo machete # dependencies a crate lists and does not use; now and then, it can be wrong
|
||||
cargo test # parsing, filters, retention, schedules, SQL, per-user state
|
||||
npx tsc -p . # type-checks web/src
|
||||
npm run -s typecheck # web/src, the service worker, and the tests' and build's TypeScript
|
||||
node tests/page-smoke.js
|
||||
node --test tests/page-unit.js # the page's own functions, called directly, in a second
|
||||
node tests/native-bridge.js # the page hands playback to a native shell
|
||||
node tests/contrast.js # every theme's palette against WCAG AA
|
||||
npx playwright test # the browser tests, against a real daemon on fixture feeds
|
||||
node tests/load/run.js # k6: many people at once against a scratch daemon with 1,500 feeds
|
||||
sh scripts/coverage.sh # which Rust lines the cargo tests reach, capped like a build (#390)
|
||||
npm run coverage:page # which lines of web/src the browser tests reach (#390)
|
||||
```
|
||||
|
||||
**Builds share Tower with everything else, production included.** On 2026-10-16 a build of the
|
||||
@@ -272,6 +274,18 @@ seeking through files, a flood of wrong passwords. Things about them:
|
||||
* The Rust tests run on Postgres with the same URL: `. /src/.envrc && cargo test`. Each test
|
||||
makes a schema `ipxt_<pid>_<n>`, and the next run drops those an earlier one left.
|
||||
|
||||
Coverage (#390) says what the tests leave untested; read it before deciding a change is covered.
|
||||
`scripts/coverage.sh` runs the Rust tests instrumented in the `ipx-coverage` image
|
||||
(`sh scripts/build-image.sh coverage` makes it), in a container held to the builder's 6 GB and six
|
||||
threads, one crate at a time, and writes `target/coverage/summary.txt`, `lcov.info` and
|
||||
`html/`. Its first run rebuilds every dependency instrumented, in a target of its own; later
|
||||
ones only what changed. It measures the cargo tests alone: the API handlers (`web.rs`) and the daemon run
|
||||
under the browser suite, whose daemon is not instrumented, so their low numbers there say little.
|
||||
`npm run coverage:page` is the browser suite on a build of the page that keeps a source map to
|
||||
each `web/src` file (`IPX_COVERAGE=1`, `web/concat-map.mts`), and writes `target/coverage/page`.
|
||||
The specs take `test` and `expect` from `tests/ui/coverage.ts`, not from `@playwright/test`, so
|
||||
every test is counted. The service worker, the unit tests and the native-bridge check are not.
|
||||
|
||||
Non-trivial logic leaves one runnable check behind. Pure functions (`merge_policy`, `pick`,
|
||||
`matches_keywords`, `parse_interval`) are the easiest place to put it.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user