📚 Clarify focused exporter test runs

Document both runner registration sites and the environment needed when
reusing a compiled test bundle.

AI-assisted-by: gpt-6.1-terra
This commit is contained in:
Andrey Antukh 2026-11-23 22:11:17 +00:00
parent a4832deef6
commit 0d80e7951a

View File

@ -1,16 +1,5 @@
# Exporter Testing
# Exporter testing
- READ `mem:testing` first.
- Tests use `cljs.test` and live under `exporter/test/exporter_tests/`.
- Register every test namespace in `exporter-tests.runner`.
- From `exporter/`: `pnpm run build:test` builds the Node test bundle without running tests.
- From `exporter/`: `pnpm run test` builds and runs tests with full output.
- From `exporter/`: `pnpm run test:quiet` builds and runs tests with reduced build output.
- After `build:test`, reuse the compiled bundle with `node target/tests/test.js`.
- For iterative focused runs, build once and reuse the compiled bundle.
- Focus a test namespace with `node target/tests/test.js --focus exporter-tests.renderer-svg-test`.
- Focus a test var with `node target/tests/test.js --focus exporter-tests.renderer-svg-test/creates-the-correct-gradient-element`.
- Set app log level by appending `--log-level warn` (or `trace|debug|info|warn|error`).
- `test:quiet` accepts forwarded options but rebuilds the bundle; prefer the direct runner after `build:test` for focused runs.
- From `exporter/`: `pnpm run check-fmt:clj` checks ClojureScript formatting.
- From `exporter/`: `pnpm run lint:clj` runs ClojureScript linting.
- READ `mem:testing` first. Tests use `cljs.test` under `exporter/test/exporter_tests/`. Add each test namespace both to the `:require` list and to `test-namespaces` in `exporter-tests.runner`.
- For a focused run, from `exporter/` compile with `pnpm run build:test`, then run `PENPOT_SECRET_KEY=test-secret-key node target/tests/test.js --focus exporter-tests.renderer-svg-test` (append `/test-var` to focus a var). Recompile after source or test changes: the direct runner executes the existing bundle. `--log-level warn` adjusts application logging.
- `pnpm run test` supplies a default test secret, but the direct runner and `test:quiet` do not; set `PENPOT_SECRET_KEY` when running them directly. `test:quiet` rebuilds even when forwarding a focus option. For the full module checks, including the test secret, see `mem:scripts/ci`.