diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-22 19:58:00 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-22 19:58:00 -0500 |
| commit | a97266c0e89ef8560824789063512d2613849fc9 (patch) | |
| tree | ba320ed3d2dfedebade1fa79ece01baaa4750bd3 /tests/test-coverage-core--backend-registry.el | |
| parent | ecca6c5809aa2945d593baae10308c0dcfe6ec17 (diff) | |
| download | dotemacs-a97266c0e89ef8560824789063512d2613849fc9.tar.gz dotemacs-a97266c0e89ef8560824789063512d2613849fc9.zip | |
feat(coverage): wire make coverage target + simplecov pipeline
Completes the coverage v1 pipeline by adding the Makefile target, the undercover driver script, the exclusion list, and the .gitignore entry. Uses simplecov JSON rather than LCOV as the collection format.
The LCOV vs simplecov choice: Undercover's :merge-report t option only supports simplecov. Since the pipeline runs tests per-file (matching test-unit's isolation pattern) and accumulates coverage across runs, merge-report is required. LCOV is better-supported by external coverage viewers, but for a primarily interactive workflow the on-disk format is an internal detail.
Other moves in this commit:
- Renamed cj/--coverage-parse-lcov to cj/--coverage-parse-simplecov and rewrote its tests for the JSON schema. Same signature, same semantics (file to set of covered lines), different parser.
- Renamed the backend protocol's :lcov-path key to :report-path, format-neutral and matching the renamed cj/--coverage-elisp-report-path function.
- The coverage target deletes modules/*.elc before running so undercover can instrument the .el sources. Without this, byte-compiled versions shadow the instrumentation and only a handful of pre-loaded modules end up with coverage data.
- Excluded tests/test-all-comp-errors.el from make coverage runs. That test byte-compiles every module, which fails under undercover's instrumentation. Excluded only from coverage. Normal make test still runs it.
- Updated docs/design/coverage.org to reflect the simplecov pivot with a historical note on why we moved off LCOV.
Verified end-to-end: make coverage produces .coverage/simplecov.json with 2717 of 4559 executable lines hit across 44 tracked modules.
Diffstat (limited to 'tests/test-coverage-core--backend-registry.el')
| -rw-r--r-- | tests/test-coverage-core--backend-registry.el | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/test-coverage-core--backend-registry.el b/tests/test-coverage-core--backend-registry.el index ac1f6f7d2..2369806fc 100644 --- a/tests/test-coverage-core--backend-registry.el +++ b/tests/test-coverage-core--backend-registry.el @@ -3,7 +3,7 @@ ;;; Commentary: ;; Unit tests for the backend registry. ;; -;; A backend is a plist with at least :name, :detect, :run, and :lcov-path +;; A backend is a plist with at least :name, :detect, :run, and :report-path ;; keys. `cj/coverage-register-backend' adds or replaces an entry. ;; `cj/--coverage-backend-for-project' resolves which backend applies to ;; a project root, honoring an optional override (buffer-local @@ -28,7 +28,7 @@ "Normal: registering a backend makes it retrievable by name." (test-coverage-registry-with-empty (cj/coverage-register-backend - '(:name elisp :detect (lambda (_) t) :run ignore :lcov-path ignore)) + '(:name elisp :detect (lambda (_) t) :run ignore :report-path ignore)) (should (= 1 (length cj/coverage-backends))) (should (eq 'elisp (plist-get (car cj/coverage-backends) :name))))) @@ -36,11 +36,11 @@ "Normal: re-registering by name replaces the existing entry at the same position." (test-coverage-registry-with-empty (cj/coverage-register-backend - '(:name elisp :detect (lambda (_) nil) :run ignore :lcov-path ignore)) + '(:name elisp :detect (lambda (_) nil) :run ignore :report-path ignore)) (cj/coverage-register-backend - '(:name python :detect (lambda (_) nil) :run ignore :lcov-path ignore)) + '(:name python :detect (lambda (_) nil) :run ignore :report-path ignore)) (cj/coverage-register-backend - '(:name elisp :detect (lambda (_) t) :run ignore :lcov-path ignore)) + '(:name elisp :detect (lambda (_) t) :run ignore :report-path ignore)) (should (= 2 (length cj/coverage-backends))) (should (eq 'elisp (plist-get (nth 0 cj/coverage-backends) :name))) (should (eq 'python (plist-get (nth 1 cj/coverage-backends) :name))) @@ -50,11 +50,11 @@ "Normal: resolution returns the first backend whose :detect matches." (test-coverage-registry-with-empty (cj/coverage-register-backend - '(:name a :detect (lambda (_) nil) :run ignore :lcov-path ignore)) + '(:name a :detect (lambda (_) nil) :run ignore :report-path ignore)) (cj/coverage-register-backend - '(:name b :detect (lambda (_) t) :run ignore :lcov-path ignore)) + '(:name b :detect (lambda (_) t) :run ignore :report-path ignore)) (cj/coverage-register-backend - '(:name c :detect (lambda (_) t) :run ignore :lcov-path ignore)) + '(:name c :detect (lambda (_) t) :run ignore :report-path ignore)) (let ((backend (cj/--coverage-backend-for-project "/tmp"))) (should (eq 'b (plist-get backend :name)))))) @@ -69,18 +69,18 @@ "Boundary: no backend's :detect matches returns nil." (test-coverage-registry-with-empty (cj/coverage-register-backend - '(:name a :detect (lambda (_) nil) :run ignore :lcov-path ignore)) + '(:name a :detect (lambda (_) nil) :run ignore :report-path ignore)) (cj/coverage-register-backend - '(:name b :detect (lambda (_) nil) :run ignore :lcov-path ignore)) + '(:name b :detect (lambda (_) nil) :run ignore :report-path ignore)) (should (null (cj/--coverage-backend-for-project "/tmp"))))) (ert-deftest test-coverage-backend-for-project-override-bypasses-detect () "Boundary: OVERRIDE returns the named backend without calling :detect." (test-coverage-registry-with-empty (cj/coverage-register-backend - '(:name a :detect (lambda (_) nil) :run ignore :lcov-path ignore)) + '(:name a :detect (lambda (_) nil) :run ignore :report-path ignore)) (cj/coverage-register-backend - '(:name b :detect (lambda (_) nil) :run ignore :lcov-path ignore)) + '(:name b :detect (lambda (_) nil) :run ignore :report-path ignore)) (let ((backend (cj/--coverage-backend-for-project "/tmp" 'b))) (should (eq 'b (plist-get backend :name)))))) @@ -91,7 +91,7 @@ (cj/coverage-register-backend `(:name a :detect ,(lambda (root) (setq captured root) t) - :run ignore :lcov-path ignore)) + :run ignore :report-path ignore)) (cj/--coverage-backend-for-project "/my/root") (should (equal "/my/root" captured))))) @@ -101,7 +101,7 @@ "Error: OVERRIDE that names an unregistered backend signals user-error." (test-coverage-registry-with-empty (cj/coverage-register-backend - '(:name a :detect (lambda (_) t) :run ignore :lcov-path ignore)) + '(:name a :detect (lambda (_) t) :run ignore :report-path ignore)) (should-error (cj/--coverage-backend-for-project "/tmp" 'bogus) :type 'user-error))) |
