]> code.delx.au - gnu-emacs-elpa/blob - test/local-coverage.el
Add local coverage configuration.
[gnu-emacs-elpa] / test / local-coverage.el
1 (defconst context-coloring-test-directory
2 (file-name-directory (or load-file-name buffer-file-name))
3 "This file's directory.")
4
5 (defun context-coloring-test-resolve-path (path)
6 "Resolve PATH from this file's directory."
7 (expand-file-name path context-coloring-test-directory))
8
9 (defconst context-coloring-coverage-output-file-prefix
10 (format-time-string "%s"))
11
12 (defconst context-coloring-coverage-output-file
13 (context-coloring-test-resolve-path
14 (concat "./coverage/" context-coloring-coverage-output-file-prefix ".json")))
15
16 (defconst context-coloring-coverage-report-file
17 (context-coloring-test-resolve-path
18 (concat "./coverage/" context-coloring-coverage-output-file-prefix ".txt")))
19
20 (defconst context-coloring-test-coverage-parser
21 (concat "node " (context-coloring-test-resolve-path "./parse-coverage.js")))
22
23 (require 'undercover)
24 (setq undercover-force-coverage t)
25 (make-directory (context-coloring-test-resolve-path "./coverage/") t)
26 (undercover "context-coloring.el"
27 (:report-file context-coloring-coverage-output-file))
28
29 (add-hook
30 'kill-emacs-hook
31 (lambda ()
32 (let* ((output-buffer (get-buffer-create "*parsed coverage*")))
33 (call-process-shell-command
34 context-coloring-test-coverage-parser
35 context-coloring-coverage-output-file
36 output-buffer)
37 (with-current-buffer output-buffer
38 (princ (buffer-substring-no-properties (point-min) (point-max)))
39 (write-file context-coloring-coverage-report-file))))
40 t)
41
42 (require 'context-coloring)