aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-05 04:58:34 -0500
committerCraig Jennings <c@cjennings.net>2026-05-05 04:58:34 -0500
commit6554cb8000a8f471f7c9e050e284f3fc364d5dad (patch)
treebdafa976a0899384e08e407465635eebfe454b77 /tests
parenta7e2eda6f36cb490a59f6c2670839ab1e52049fc (diff)
downloademacs-wttrin-6554cb8000a8f471f7c9e050e284f3fc364d5dad.tar.gz
emacs-wttrin-6554cb8000a8f471f7c9e050e284f3fc364d5dad.zip
build: switch Makefile to eask, wire up undercover coverage
I wanted a coverage number, so I added an Eask file declaring the runtime dep (xterm-color) plus three dev deps (undercover, package-lint, elisp-lint). The Makefile now runs every test and lint recipe through `eask emacs`. That drops the hand-rolled `(require 'package)` + `add-to-list 'package-archives` boilerplate that was duplicated across six recipes. I added a `make deps` target that runs `eask install-deps --dev`. I also added a `make coverage` target that loads `tests/run-coverage-file.el` before each unit-test file. Undercover instruments the three source files first, then the test loads pick up the instrumented copy. Per-file results merge into `.coverage/simplecov.json` in simplecov format. I expanded `validate-parens` and `compile` to cover all three source files instead of just `wttrin.el`. Lint stays scoped to the main file for now. Coverage right now is 84% overall: wttrin.el 92%, wttrin-geolocation.el 100%, wttrin-debug.el 27%. The debug module is low because only the integration test exercises it. The coverage loop runs unit tests only.
Diffstat (limited to 'tests')
-rw-r--r--tests/run-coverage-file.el34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/run-coverage-file.el b/tests/run-coverage-file.el
new file mode 100644
index 0000000..347dc1f
--- /dev/null
+++ b/tests/run-coverage-file.el
@@ -0,0 +1,34 @@
+;;; run-coverage-file.el --- Undercover setup for per-file coverage runs -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;; Loaded by `make coverage' before each unit-test file, BEFORE the
+;; wttrin source files are loaded. Instrumenting must happen first so
+;; the subsequent loads pick up the instrumented source.
+;;
+;; Coverage data is merged across per-file invocations into a single
+;; simplecov JSON at .coverage/simplecov.json.
+
+;;; Code:
+
+(unless (require 'undercover nil t)
+ (message "")
+ (message "ERROR: undercover not installed.")
+ (message "Add `undercover' to Eask as a development dep, then run `make deps'.")
+ (message "")
+ (kill-emacs 1))
+
+;; Force coverage collection in non-CI environments. Must be set after
+;; loading undercover because the library's top-level form
+;; `(setq undercover-force-coverage (getenv "UNDERCOVER_FORCE"))' would
+;; otherwise overwrite the value.
+(setq undercover-force-coverage t)
+
+(undercover "wttrin.el"
+ "wttrin-debug.el"
+ "wttrin-geolocation.el"
+ (:report-format 'simplecov)
+ (:report-file ".coverage/simplecov.json")
+ (:merge-report t)
+ (:send-report nil))
+
+;;; run-coverage-file.el ends here