Skip to content

Commit 9455abe

Browse files
Fix flaky Emacs e2e test: replace fixed sleep with diagnostic polling loop (#2276)
* Initial plan * Fix timing issue in Emacs test by polling for flymake diagnostics Agent-Logs-Url: https://github.com/PowerShell/PowerShellEditorServices/sessions/19f2e25d-3a5e-4570-97bf-ce36493b9795 Co-authored-by: andyleejordan <2226434+andyleejordan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: andyleejordan <2226434+andyleejordan@users.noreply.github.com>
1 parent 30a35f8 commit 9455abe

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

test/emacs-test.el

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,12 @@
6161
(let ((lsp (eglot-current-server)))
6262
(should (string= (eglot--project-nickname lsp) "PowerShellEditorServices"))
6363
(should (member (cons 'powershell-mode "powershell") (eglot--languages lsp))))
64-
(sleep-for 5) ; TODO: Wait for "textDocument/publishDiagnostics" instead
6564
(flymake-start)
65+
;; Wait for diagnostics to arrive instead of sleeping a fixed duration
66+
(let ((deadline (time-add (current-time) 30)))
67+
(while (and (time-less-p (current-time) deadline)
68+
(null (flymake-diagnostics)))
69+
(sleep-for 0.5)))
6670
(goto-char (point-min))
6771
(flymake-goto-next-error)
6872
(should (eq 'flymake-warning (face-at-point))))))

0 commit comments

Comments
 (0)