Skip to content

Commit 3db9f93

Browse files
committed
Improve test output to be more precise on output messages.
1 parent 3c8c257 commit 3db9f93

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44

55
* Avoid outdated test tree after tests run.
6+
* Improve test output to be more precise on output messages.
67

78
## 1.24.1
89

lsp-dart-test-output.el

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ When set to `display-only' the buffer will be displayed, but it will
3535
not become focused, otherwise the buffer is displayed and focused."
3636
:group 'lsp-dart
3737
:type '(choice (const :tag "Create the buffer, but don't display it" nil)
38-
(const :tag "Create and display the buffer, but don't focus it" display-only)
39-
(const :tag "Create, display, and focus the buffer" t)))
38+
(const :tag "Create and display the buffer, but don't focus it" display-only)
39+
(const :tag "Create, display, and focus the buffer" t)))
4040

4141

4242
;;; Internal
@@ -49,7 +49,7 @@ not become focused, otherwise the buffer is displayed and focused."
4949

5050
(defvar lsp-dart-test-output--tests-count 0)
5151
(defvar lsp-dart-test-output--tests-passed 0)
52-
(defvar lsp-dart-test-output--first-log t)
52+
(defvar lsp-dart-test-output--show-loading-tests-message t)
5353

5454
(defconst lsp-dart-test-output--buffer-name "*LSP Dart tests*")
5555

@@ -142,12 +142,13 @@ not become focused, otherwise the buffer is displayed and focused."
142142

143143
(defun lsp-dart-test-output--handle-run-started ()
144144
"Handle test run started."
145-
(setq lsp-dart-test-output--first-log t)
145+
(setq lsp-dart-test-output--show-loading-tests-message t)
146146
(lsp-dart-test-output--show-buffer)
147-
(lsp-dart-test-output--send "Running tests...\n"))
147+
(lsp-dart-test-output--send "Spawning test process..."))
148148

149149
(defun lsp-dart-test-output--handle-all-start (_notification)
150150
"Handle all start notification."
151+
(lsp-dart-test-output--send "Running tests...")
151152
(setq lsp-dart-test-output--tests-count 0)
152153
(setq lsp-dart-test-output--tests-passed 0))
153154

@@ -157,11 +158,11 @@ not become focused, otherwise the buffer is displayed and focused."
157158

158159
(lsp-defun lsp-dart-test-output--handle-done ((notification &as &TestDoneNotification :result :time :hidden) test-name test-start-time)
159160
"Handle test done notification."
160-
(when lsp-dart-test-output--first-log
161+
(when lsp-dart-test-output--show-loading-tests-message
161162
(with-current-buffer (lsp-dart-test-output--get-buffer-create)
162163
(let ((inhibit-read-only t))
163164
(erase-buffer)))
164-
(setq lsp-dart-test-output--first-log nil))
165+
(setq lsp-dart-test-output--show-loading-tests-message nil))
165166
(let ((text (propertize (concat (lsp-dart-test-output--get-icon notification)
166167
" "
167168
test-name)

lsp-dart-test-tree.el

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ POSITION is the test start position."
322322
(lsp-dart-test-tree-add-suite suite))
323323

324324
(lsp-defun lsp-dart-test-tree--handle-group ((&GroupNotification :group))
325-
(lsp-dart-test-tree-set-group group))
325+
(lsp-dart-test-tree-set-group group))
326326

327327
(lsp-defun lsp-dart-test-tree--handle-start ((&TestStartNotification :test))
328328
"Handle test start notification."
@@ -332,9 +332,17 @@ POSITION is the test start position."
332332
"Handle test done notification."
333333
(lsp-dart-test-tree-mark-as-done test-id (- time test-start-time) result skipped))
334334

335+
(defun lsp-dart-test-tree--render-final (suite-or-group)
336+
"Rebuild the test tree for SUITE-OR-GROUP one last time."
337+
(seq-map
338+
(-lambda ((_group-id . group))
339+
(lsp-dart-test-tree--render-final group)
340+
(lsp-dart-test-tree--render))
341+
(plist-get suite-or-group :groups)))
342+
335343
(defun lsp-dart-test-tree--handle-all-done (_params)
336344
"Handle test done notification."
337-
(lsp-dart-test-tree--render))
345+
(seq-map #'lsp-dart-test-tree--render-final (map-values lsp-dart-test-tree--suites)))
338346

339347

340348
;;; Public

0 commit comments

Comments
 (0)