Skip to content

Commit

Permalink
Fix CI tests: download SonarLint before testing
Browse files Browse the repository at this point in the history
  • Loading branch information
necto committed Jul 13, 2024
1 parent 63ef56b commit 26e9cec
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ EASK ?= eask

TEST-FILES := $(shell ls test/*.el)

.PHONY: clean checkdoc lint package install compile test
.PHONY: clean checkdoc lint package install compile download-sonarlint test

ci: clean package install compile test
ci: clean package install compile download-sonarlint test

package:
@echo "Packaging..."
Expand All @@ -21,6 +21,10 @@ compile:
@echo "Compiling..."
$(EASK) compile

download-sonarlint:
@echo "Downloading SonarLint..."
$(EASK) eval '(progn (require (quote lsp-sonarlint)) (lsp-sonarlint-download))'

test:
@echo "Testing..."
$(EASK) test ert $(TEST-FILES)
Expand Down
10 changes: 9 additions & 1 deletion test/lsp-sonarlint-integration-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@
(require 'lsp-mode)
(require 'lsp-sonarlint)

(ert-deftest lsp-sonarlint-plugin-downloaded ()
"Check whether you have downloaded SonarLint.
This is a prerequisite for all the integration tests. If this
test fails, you need to download the SonarLint plugin using
make download-sonarlint"
(should (file-exists-p (concat lsp-sonarlint-download-dir "/extension/server/sonarlint-ls.jar"))))

(defun lsp-sonarlint--wait-for (predicate hook timeout)
"Register PREDICATE to run on HOOK, and wait until it returns t.
If that does not occur before TIMEOUT, throw an error."
Expand Down Expand Up @@ -72,7 +81,6 @@ only works for specific textDocument/didOpen:languageId."
(lsp-enable-snippet nil)
received-warnings)
(let ((buf (find-file-noselect file))
(lsp-sonarlint-plugin-autodownload t)
(diagnostics-updated nil)
(register-warning (lambda (&rest w) (when (equal (car w) 'lsp-mode)
(push (cadr w) received-warnings)))))
Expand Down

0 comments on commit 26e9cec

Please sign in to comment.