Skip to content
Merged
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
11 changes: 7 additions & 4 deletions lisp/cider-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -773,14 +773,16 @@ NO-SELECT is non-nil."
(cider-insert "The test run ended before its report arrived."
'cider-test-error-face t))))

(defun cider-test--handle-event (event report silent)
(defun cider-test--handle-event (event report silent &optional one-ns)
"Show the progress carried by the test EVENT of a streamed run.
REPORT is the report buffer the run has put failures into so far, or nil.
If SILENT is non-nil, don't echo the progress. Return the report buffer."
If SILENT is non-nil, don't echo the progress. ONE-NS non-nil means the
run is for a single namespace, which was announced as the run started,
so it isn't announced again. Return the report buffer."
(nrepl-dbind-response event (type ns results summary)
(pcase type
("begin-ns"
(unless silent
(unless (or silent one-ns)
(cider-test-echo-running ns)))
("end-var"
(unless silent
Expand Down Expand Up @@ -1018,7 +1020,8 @@ running them."
(err (cider-emit-interactive-eval-err-output err))
(test-event
(setq streamed-report
(cider-test--handle-event test-event streamed-report silent)))
(cider-test--handle-event test-event streamed-report silent
(stringp ns))))
(results
(nrepl-dbind-response summary (error fail)
(setq cider-test-last-summary summary)
Expand Down
23 changes: 22 additions & 1 deletion test/cider-test-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@
nil t)
(expect 'message :not :to-have-been-called))

(it "doesn't announce the namespace again in a single-namespace run"
(cider-test--handle-event (cider-test-tests--event "type" "begin-ns" "ns" "foo-test")
nil nil t)
(expect 'message :not :to-have-been-called))

(it "leaves the report alone for a var without failures"
(expect (cider-test--handle-event
(cider-test-tests--event "type" "end-var" "ns" "foo-test" "var" "a"
Expand Down Expand Up @@ -375,4 +380,20 @@
"summary" (nrepl-dict "test" 1 "fail" 1 "error" 0))))
(funcall callback (nrepl-dict "status" '("done" "interrupted")))
(with-current-buffer cider-test-report-buffer
(expect (buffer-string) :to-match "ended before its report arrived")))))
(expect (buffer-string) :to-match "ended before its report arrived"))))

(it "announces a namespace only once in a single-namespace run"
(let ((cider-test-stream-results t))
(spy-on 'cider-test-echo-running)
(cider-test-execute "foo-test")
(funcall callback (nrepl-dict "test-event"
(nrepl-dict "type" "begin-ns" "ns" "foo-test")))
(expect 'cider-test-echo-running :to-have-been-called-times 1)))

(it "announces each namespace of a multi-namespace run"
(let ((cider-test-stream-results t))
(spy-on 'cider-test-echo-running)
(cider-test-execute :loaded)
(funcall callback (nrepl-dict "test-event"
(nrepl-dict "type" "begin-ns" "ns" "foo-test")))
(expect 'cider-test-echo-running :to-have-been-called-times 2))))
Loading