spacemacs

Spacemacs docs: http://develop.spacemacs.org/doc/DOCUMENTATION.html http://develop.spacemacs.org/layers/+lang/clojure/README.html https://practicalli.github.io/spacemacs/
craftybones 2020-06-04T08:24:46.318600Z

I am unable to run tests. It complains on missing ring’s mock request. I initially thought that the REPL might not have been launched with the right alias, so I launched it with the right alias, but it is still bombing for that reason

craftybones 2020-06-04T08:32:51.319200Z

How do I get nrepl to pick up deps.edn’s src/test etc?

craftybones 2020-06-04T08:32:56.319400Z

I mean the aliases in deps.edn

craftybones 2020-06-04T08:33:27.320200Z

I’m doing Spc U followed by , ' and then typing in the alias I awnt

craftybones 2020-06-04T08:33:28.320400Z

*want

craftybones 2020-06-04T08:33:36.320800Z

However, it doesn’t seem to be picking the dependency

craftybones 2020-06-04T08:40:17.321400Z

my deps.edn has a test alias that contains the mock lib I am using

practicalli-john 2020-06-04T08:42:53.323400Z

The alias used with Cider should include the test path, or as a hack you can add test to the main path definition in deps.edn

practicalli-john 2020-06-04T08:44:22.326Z

Create a dir-locals.el file to set the default aliases for a project and starting Cider will then use them. Here is how to create a dir locals (although you need a different variable) https://practicalli.github.io/spacemacs/clojure-projects/monorepo-nested-projects.html

practicalli-john 2020-06-04T08:45:42.327Z

Here is a post that explains all the options, towards the end is the dir-locals example https://practicalli.github.io/blog/posts/cider-jack-in-to-clojure-cli-projects-from-spacemacs/

practicalli-john 2020-06-04T08:46:50.327700Z

((clojure-mode . ((cider-clojure-cli-global-options . "-A:alias-names"))))

practicalli-john 2020-06-04T08:49:21.329700Z

You will need to reopen the Clojure file (or revert buffer) to force the dir-locals.el file to be read by Emacs

practicalli-john 2020-06-04T08:51:15.331100Z

If that doesn’t fix it, I can take a look at the code (if you are able to share it)

practicalli-john 2020-06-04T08:53:24.332600Z

Also ensure that the deftest functions have been evaluated and you have included the relevant requires and dependencies.

craftybones 2020-06-04T09:04:16.333100Z

I got the tesst working. Thanks. I was putting the -A after the -S so the deps weren’t taking. My fault

craftybones 2020-06-04T09:04:37.333600Z

However, upon rerunning tests, I am not sure where the reports are. The cider-test-report buffer shows an older result

practicalli-john 2020-06-04T09:07:04.335500Z

If tests are changed without re-evaluating those tests, the results of the previous version will be shown. Is that what is happening? Same if you change the name of a deftest function, the old one will run as its still in the memory of the REPL.

craftybones 2020-06-04T09:09:08.335900Z

I am changing a test, saving it and typing in , t a

practicalli-john 2020-06-04T09:13:00.338800Z

, t a in the test code buffer will evaluate all the functions in that namespace, so any changes should get picked up. Running the tests from a source code buffer does not evaluate the test code and therefore any changes in test code is not picked up, unless you go and evaluate them, eg, , e f on the deftest code.

jumar 2020-06-05T12:10:19.350300Z

isn't , t a for running all the tests? It was changed some time ago I think; it's now , t n to run ns tests.

practicalli-john 2020-06-05T12:11:53.351400Z

I've not used ns tests, whats that? Is it just for the specific namespace you are in and does it evaluate the current test code in the buffer?

jumar 2020-06-05T12:14:01.353800Z

You said > , t a in the test code buffer will evaluate all the functions in that namespace I thought you meant this to run all the tests in a particular namespace (buffer). , t a used to work like that but now it's , t n

practicalli-john 2020-06-05T12:41:02.355300Z

Ah yes, I was really talking about picking up code changes rather than the scope of tests that are run. Sorry for the confusion.

practicalli-john 2020-06-04T09:16:59.340700Z

The test report only shows if you have failed tests by default. If all tests pass, a message is shown in the mini-buffer and a test report is not generated, so , t b does not find a report. Once a test report is generated, it should be updated each time , t a is run. To have the test report generated on success, set the custom variable cider-test-show-report-on-success to true in the Clojure layer configuration. For example:

(clojure :variables
              clojure-toplevel-inside-comment-form t
              cider-overlays-use-font-lock t
              clojure-enable-linters 'clj-kondo
              cider-test-show-report-on-success t)