Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve REPL test development #125

Closed
aldosolorzano opened this issue Mar 31, 2023 · 6 comments
Closed

Improve REPL test development #125

aldosolorzano opened this issue Mar 31, 2023 · 6 comments

Comments

@aldosolorzano
Copy link
Contributor

aldosolorzano commented Mar 31, 2023

One of the great things about clojure is the REPL development, not only for code changes but to also run tests. Even tho bob tests are tricky, I believe it's possible to improve them. In my quest to run tests inside my REPL editor I found some problems, described below:

Test path is not included

If you fire up the repl and got to the ns runner.pipeline-test and try to load the ns, we get this error.

Execution error (FileNotFoundException) at runner.pipeline-test/eval5680$loading (pipeline_test.clj:7).
Could not locate runner/engine_test__init.class, runner/engine_test.clj or runner/engine_test.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.

Digging a little bit I found out that we are not inlcuding the "test" folder in deps.edn {:paths ["src" "resources"] ...} and that makes clojure not been able place the root path correctly.

  • How can we load the "test" path only when in dev mode using deps.edn?

Extra deps used only for testing are not included too

Similar to the problem above, the extra dependencies are not included therefore the tests break because they depend on those.

@TimoKramer
Copy link
Member

Hey @aldosolorzano,
good catch. The :extra-path for :test-alias is not included. I believe because kaocha has this as a default value and it should not be needed when using kaocha as test-runner. It surely is not hurting adding the :extra-path to the :test-alias.

Kaocha-doc: https://github.com/lambdaisland/kaocha/blob/main/doc/03_configuration.md

@lispyclouds
Copy link
Member

Yeah but I think the use case mentioned here is to have the test path in the usual repl mode as well which wouldn't use the :test alias. Maybe simply documenting that people should start their repls with an extra -Sdeps mentioning the test paths suffices than adding anything to the deps.edn?
Otherwise we need to have another alias :dev which would duplicate the deps just for adding the extra path?

@TimoKramer
Copy link
Member

I am starting my repl with clj -M:test:repl and it works somehow.

@aldosolorzano
Copy link
Contributor Author

start their repls with an extra -Sdeps mentioning the test paths suffices than adding anything to the deps.edn

How would you do that? @lispyclouds I tried what @TimoKramer did and it's not working for me, I'm doing it inside the runner

I work with emacs+cider using nrepl so what it's wokring for me it's

:repl {:extra-paths ["test"]
                  :extra-deps {nrepl/nrepl {:mvn/version "0.8.3"}
                               cider/cider-nrepl {:mvn/version "0.30.0"}
                               org.clojure/test.check {:mvn/version "1.1.1"}
                               com.github.seancorfield/next.jdbc {:mvn/version "1.3.862"}}
                  :main-opts  ["-m" "nrepl.cmdline"
                               "--middleware" "[cider.nrepl/cider-middleware]"]}

But we have the duplicated extra-deps.
question: how do I know in which port a repl is running?

@lispyclouds
Copy link
Member

lispyclouds commented Apr 19, 2023

@aldosolorzano Added a new task repl to all the bb.edns in the services in 0429b32

It should start an nREPL in a port with all the right paths and deps. Try that out, lemme know if that's any improvement!

@lispyclouds
Copy link
Member

This seems to be addressed, do reopen otherwise!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants