@@ -8,7 +8,7 @@ dockerized integration tests, and joint line coverage.
|
||||
## Requirements
|
||||
|
||||
- Docker, for the integration tests and the `script/docker-*` tasks (all CI needs)
|
||||
- For running tasks natively (optional): [Clojure CLI](https://clojure.org/guides/install_clojure) (tools.deps) with JDK 21+, [Node](https://nodejs.org/) 20+ (with a JDK) for the UI build, and [Babashka](https://babashka.org/) for `script/coverage-report`
|
||||
- For running tasks natively (optional): [Clojure CLI](https://clojure.org/guides/install_clojure) (tools.deps) with JDK 21+, [Node](https://nodejs.org/) 20+ (22.22+ for the UI tests; with a JDK) for the UI build, and [Babashka](https://babashka.org/) for `script/coverage-report`
|
||||
|
||||
## Running
|
||||
|
||||
@@ -224,7 +224,8 @@ directory at `/js`, and serves `resources/public/index.html`, the shell that mou
|
||||
| `script/ui-build` | Optimized release build into `resources/public/js` |
|
||||
| `script/ui-watch` | Rebuilds on every change, with hot reload; run `script/server` alongside and refresh the page |
|
||||
|
||||
The Docker image builds the UI in its own stage, so `docker build` needs no local Node.
|
||||
The Docker image builds the UI in its own stage, so `docker build` needs no local Node. The UI's tests run
|
||||
in another stage of the same Dockerfile (`--target ui-test`), which the server image doesn't include.
|
||||
|
||||
### Browser MCP tools (WebMCP)
|
||||
|
||||
@@ -271,23 +272,35 @@ script/repl
|
||||
| Task | What it does |
|
||||
|------|--------------|
|
||||
| `script/unit-test` | Runs the Clojure tests in `test/` |
|
||||
| `script/ui-test` | Runs the ClojureScript tests in `ui/test/` under Node (needs Node and a JDK; CI doesn't run it yet) |
|
||||
| `script/ui-test` | Runs the ClojureScript tests in `ui/test/` under Node, in a [jsdom](https://github.com/jsdom/jsdom) window (needs Node and a JDK) |
|
||||
| `script/integration-test` | Builds the app image, starts it on a random port, runs the [integration suite](integration-test/README.md) against it, then tears it down |
|
||||
| `script/test` | Unit tests, then integration tests (stops at the first failure) |
|
||||
| `script/test` | UI tests, unit tests, then integration tests (stops at the first failure) |
|
||||
| `script/docker-unit-test` | Same as `script/unit-test`, but inside the app image (Docker only) |
|
||||
| `script/docker-ui-test` | Same as `script/ui-test`, but inside a Node + JDK image (Docker only) |
|
||||
|
||||
The UI tests render the real app in jsdom against a fake server and drive it like a user (type, submit,
|
||||
click), next to plain tests of the re-frame events and subscriptions, the game rules and the WebMCP tools
|
||||
(`ui/test/tbd/ui/`; the shared fakes are in `test_util.cljs`). `ui/test/dom-setup.cjs` gives them a
|
||||
`window` and the real WebMCP library, and fails a run that hangs, rejects a promise nobody handles, or ends
|
||||
without a result (a test that never calls `done` would otherwise pass or stall silently). `npm test` in
|
||||
`ui/` preloads it, so use that (or the scripts) rather than running the build's output directly.
|
||||
|
||||
### Coverage
|
||||
|
||||
Line coverage via [Cloverage](https://github.com/cloverage/cloverage):
|
||||
Line coverage of the Clojure code via [Cloverage](https://github.com/cloverage/cloverage), and of the UI via
|
||||
[c8](https://github.com/bcoe/c8):
|
||||
|
||||
| Task | Output |
|
||||
|------|--------|
|
||||
| `script/unit-coverage` | `target/coverage/unit/` |
|
||||
| `script/integration-coverage` | `target/coverage/integration/` |
|
||||
| `script/coverage` | Runs both, then writes the merged report to `target/coverage/merged/` |
|
||||
| `script/docker-unit-coverage`, `script/docker-coverage-report` | Dockerized versions of the unit run and the merge step, so `script/docker-unit-coverage`, `script/integration-coverage`, `script/docker-coverage-report` is `script/coverage` with no local Clojure or Babashka (this is what CI runs) |
|
||||
| `script/ui-coverage` | `target/coverage/ui/` (V8 coverage of the compiled UI, mapped back to `ui/src/**/*.cljs` through the source maps) |
|
||||
| `script/coverage` | Runs all three, then writes the merged Clojure report to `target/coverage/merged/` (the UI's stays separate) |
|
||||
| `script/docker-unit-coverage`, `script/docker-ui-coverage`, `script/docker-coverage-report` | Dockerized versions of the unit run, the UI run and the merge step, so `script/docker-ui-coverage`, `script/docker-unit-coverage`, `script/integration-coverage`, `script/docker-coverage-report` is `script/coverage` with no local Clojure, Node or Babashka (this is what CI runs) |
|
||||
|
||||
Each report directory has an `index.html` and an `lcov.info`. See
|
||||
Each report directory has an `index.html` and an `lcov.info`. The UI's numbers are approximate where one
|
||||
ClojureScript form compiles to several JavaScript blocks (a `case` or `cond`, say): a line can show as
|
||||
uncovered when only part of the form ran. See
|
||||
[integration-test/README.md](integration-test/README.md) for how integration coverage is
|
||||
collected.
|
||||
|
||||
@@ -310,7 +323,7 @@ ui/ ClojureScript re-frame app (shadow-cljs project); ui/src/t
|
||||
resources/public/ index.html (the shell served at /) and js/ (compiled UI output, git-ignored)
|
||||
test/ Unit tests
|
||||
integration-test/ Dockerized integration tests and coverage harness
|
||||
script/ Bash entry points (server, ui-build, test, coverage, repl, ...) and coverage helpers
|
||||
script/ Bash entry points (server, ui-build, ui-test, test, coverage, repl, ...) and coverage helpers
|
||||
```
|
||||
|
||||
To add a new group, create `tbd.<group>.routes` with a `routes` fn that returns a reitit route
|
||||
|
||||
Reference in New Issue
Block a user