From 40227d6c3471fbd54e370552078783555e1f23a7 Mon Sep 17 00:00:00 2001 From: moxaj Date: Mon, 15 Aug 2016 21:05:26 +0200 Subject: [PATCH 1/3] Use run-tests with relevant namespaces instead of run-all-tests --- lib/proto-repl.coffee | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/proto-repl.coffee b/lib/proto-repl.coffee index 3f19683..a4b8958 100644 --- a/lib/proto-repl.coffee +++ b/lib/proto-repl.coffee @@ -570,7 +570,15 @@ module.exports = ProtoRepl = else @refreshNamespaces => # Tests are only run if the refresh is successful. - @executeCode("(def all-tests-future (future (time (clojure.test/run-all-tests))))") + @executeCode("(do (require '[clojure.tools.namespace.dir :refer [scan-all]] + '[clojure.test :refer [run-tests]]) + (->> (scan-all {}) + :clojure.tools.namespace.track/deps + :dependencies + (keys) + (apply run-tests) + (time) + (future)))") printVarDocumentation: -> if editor = atom.workspace.getActiveTextEditor() From ee80f77454009d4a6bcfb0f58e63970db672015d Mon Sep 17 00:00:00 2001 From: moxaj Date: Mon, 15 Aug 2016 21:06:37 +0200 Subject: [PATCH 2/3] runAllTests no longer requires an active editor tab --- lib/proto-repl.coffee | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/lib/proto-repl.coffee b/lib/proto-repl.coffee index a4b8958..d793640 100644 --- a/lib/proto-repl.coffee +++ b/lib/proto-repl.coffee @@ -564,21 +564,20 @@ module.exports = ProtoRepl = @executeCodeInNs(code) runAllTests: -> - if editor = atom.workspace.getActiveTextEditor() - if @isSelfHosted() - @stderr("Running tests is not supported yet in self hosted REPL.") - else - @refreshNamespaces => - # Tests are only run if the refresh is successful. - @executeCode("(do (require '[clojure.tools.namespace.dir :refer [scan-all]] - '[clojure.test :refer [run-tests]]) - (->> (scan-all {}) - :clojure.tools.namespace.track/deps - :dependencies - (keys) - (apply run-tests) - (time) - (future)))") + if @isSelfHosted() + @stderr("Running tests is not supported yet in self hosted REPL.") + else + @refreshNamespaces => + # Tests are only run if the refresh is successful. + @executeCode("(do (require '[clojure.tools.namespace.dir :refer [scan-all]] + '[clojure.test :refer [run-tests]]) + (->> (scan-all {}) + :clojure.tools.namespace.track/deps + :dependencies + (keys) + (apply run-tests) + (time) + (future)))") printVarDocumentation: -> if editor = atom.workspace.getActiveTextEditor() From a5d36976a729f14f3885c50253e1e41478552474 Mon Sep 17 00:00:00 2001 From: moxaj Date: Fri, 19 Aug 2016 12:03:41 +0200 Subject: [PATCH 3/3] More reliable namespace tracking --- lib/proto-repl.coffee | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/proto-repl.coffee b/lib/proto-repl.coffee index d793640..12fc2f2 100644 --- a/lib/proto-repl.coffee +++ b/lib/proto-repl.coffee @@ -572,9 +572,7 @@ module.exports = ProtoRepl = @executeCode("(do (require '[clojure.tools.namespace.dir :refer [scan-all]] '[clojure.test :refer [run-tests]]) (->> (scan-all {}) - :clojure.tools.namespace.track/deps - :dependencies - (keys) + :clojure.tools.namespace.track/load (apply run-tests) (time) (future)))")