Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print test output properly with --win and --no-win #37

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cask
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

(package-file "ert-runner.el")

(files ("*.el"
("bin" "bin/*")
("reporters" "reporters/*.el")))

(development
(depends-on "s")
(depends-on "dash")
Expand Down
21 changes: 14 additions & 7 deletions ert-runner.el
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ Arguments: stats, test, result")

This bypasses the normal output capturing ert-runner does, and is
primarily intended for reporters."
(princ (apply #'format format args)
t))
(let ((message (apply #'format format args)))
(if ert-runner-output-file
(f-append-text message 'utf-8 ert-runner-output-file)
(princ message t))))

;; Work around Emacs bug #16121, which is fixed in Emacs 24.4, but still present
;; in former releases. See ;; http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16121
Expand Down Expand Up @@ -196,14 +198,19 @@ nil, `ert-runner-test-path' will be used instead."
(ert-runner/use-reporter ert-runner-reporter-name)
(let ((test-files (ert-runner--test-files tests))
(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))
(-each test-files #'ert-runner--load)
(condition-case e
(progn
(-each ert-runner-load-files #'ert-runner--load)
(if (f-exists? test-helper)
(ert-runner--load test-helper))
(-each test-files #'ert-runner--load))
(error
(ert-runner-message "Error during test setup: %S. No tests were run.\n" e)
(kill-emacs 1)))
(if ert-runner-verbose
(ert-runner/run-tests-batch-and-exit ert-runner-selector)
(shut-up
(ert-runner/run-tests-batch-and-exit ert-runner-selector)))))
(ert-runner/run-tests-batch-and-exit ert-runner-selector)))))

(defun ert-runner/init (&optional name)
"Create new test project (optional project name)."
Expand Down