Skip to content

Commit

Permalink
Fix reload-all behavior for clj-reload (#854)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipesilva authored Mar 10, 2024
1 parent 95ce24b commit 3a4c86f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## master (unreleased)

## Bugs fixed

* [#854](https://github.com/clojure-emacs/cider-nrepl/pull/854): fix cider.clj-reload/reload-all and improve its test

## 0.46.0 (2024-0305)

### New features
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
~(with-meta '[org.clojure/tools.namespace "1.3.0"]
;; :cognitest uses tools.namespace, so we cannot inline it while running tests.
{:inline-dep (not= "true" (System/getenv "SKIP_INLINING_TEST_DEPS"))})
^:inline-dep [io.github.tonsky/clj-reload "0.4.0"]
^:inline-dep [io.github.tonsky/clj-reload "0.4.1"]
^:inline-dep [org.clojure/tools.trace "0.7.11"]
^:inline-dep [org.clojure/tools.reader "1.3.6"]
[mx.cider/logjam "0.3.0"]]
Expand Down
2 changes: 1 addition & 1 deletion src/cider/nrepl/middleware/reload.clj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
reload (user-reload 'reload reload/reload)
unload (user-reload 'unload reload/unload)]
(cond
(:all msg) (reload (assoc opts :all true))
(:all msg) (reload (assoc opts :only :all))
(:clear msg) (unload opts)
:else (reload opts))))

Expand Down
7 changes: 5 additions & 2 deletions test/clj/cider/nrepl/middleware/reload_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
(:require
[cider.nrepl.middleware.reload :as rl]
[cider.nrepl.test-session :as session]
[clojure.string :as str]
[clojure.test :refer :all]))

(use-fixtures :each session/session-fixture)
Expand Down Expand Up @@ -33,8 +34,10 @@

(deftest reload-all-op-test
(testing "reload-all op works"
(let [response (session/message {:op "cider.clj-reload/reload-all"})]
(is (seq (:progress response)))
(let [response (session/message {:op "cider.clj-reload/reload-all"})
progress-str (:progress response)]
(is (str/includes? progress-str "Unloading cider.nrepl.middleware.util.meta-test"))
(is (str/includes? progress-str "Loading cider.nrepl.middleware.util.meta-test"))
(is (= #{"done" "ok"} (:status response))))))

(deftest reload-clear-op-test
Expand Down

0 comments on commit 3a4c86f

Please sign in to comment.