Skip to content

Instantly share code, notes, and snippets.

@mattdeboard
Created September 7, 2014 23:21
Show Gist options
  • Save mattdeboard/6a6d68a824a2e8ac5648 to your computer and use it in GitHub Desktop.
Save mattdeboard/6a6d68a824a2e8ac5648 to your computer and use it in GitHub Desktop.
(defun ert-runner/run (&rest tests)
(unless (f-dir? ert-runner-test-path)
(error (ansi-red "No test directory. Create one using `ert-runner init`")))
(ert-runner/use-reporter ert-runner-reporter-name)
(let* ((el-tests-fn
(lambda (file)
(if tests
(--any? (s-ends-with? it file) tests)
(s-matches? "-test\.el$" file))))
(test-files (f-files (f-expand ert-runner-test-path) el-tests-fn))
(test-helper
(f-expand "test-helper.el" ert-runner-test-path)))
(-each ert-runner-load-files #'ert-runner--load)
(if (f-exists? test-helper)
(ert-runner--load test-helper))
(message (ansi-red ert-runner-exit))
(-each test-files #'ert-runner--load)
(cl-flet ((test-runner-fn (selector)
(if ert-runner-exit
(ert-runner/run-tests-batch-and-exit selector)
(ert-runner/run-tests-batch selector))))
(if ert-runner-verbose
(test-runner-fn ert-runner-selector)
(shut-up
(test-runner-fn ert-runner-selector))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment