Fork me on GitHub
#leiningen
<
2020-03-23
>
reefersleep08:03:56

I have a test-specific dependency that I would like not to burden the main project with. It’s in the :test profile’s dependency vector. Great. But when I start my repl, I get errors that the test ns that uses the dependency is missing it. How can I start my repl and exclude my test nses?

jumar08:03:56

Why not adding them to the :dev profile? I mean, I'd definitely want my tests to be available in the REPL.

jumar08:03:22

https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#default-profiles > The `:dev` profile is used to specify project specific development tooling. Put things here if they are required for builds or tests, rather than just convenience tooling.

reefersleep08:03:31

Good point. I’ll see if that makes sense in this project 🙂 Thanks!

reefersleep08:03:39

Do you know if there’s a way to exclude stuff, though?

reefersleep08:03:22

yeah, but I mean ns’es in the project

reefersleep11:03:41

I don’t know if other people have had uses cases for it. Perhaps one would also like some scratch ns where crazy things could be coded, but which wouldn’t affect production, and perhaps not (automatically) other developers at dev time. You could then pull it into the repl at a later point if you wanted.

jumar11:03:54

Namespaces are usually not loaded unless they are required. So if you don't require a particular file you can keep it there and it shouldn't break anybody's environment. That's said, things like lein check may go through every file...

reefersleep12:03:24

Hm. That’s what I tought, too. Perhaps there’s something requiring our test ns’es dynamically.

reefersleep12:03:42

(I get the dependency error at repl startup time)

noisesmith17:03:51

I usually use lein with-profile +test repl myself, but putting them under dev is definitely more elegant...

reefersleep08:03:53

That’s what I was doing, @U051SS2EU, but I wanted to avoid forcing every other developer on this project to do the same

reefersleep08:03:11

I ended up putting my dependency into the :dev profile vector like @U06BE1L6T suggested, that solves my problem. I’m still wondering why test ns’es are loaded when I start my repl, but that’s a different issue.

noisesmith16:03:51

loading all test namespaces is one of the behaviors of the test profile isn't it?

reefersleep09:03:54

I don’t know. But I wasn’t explicitly running the test profile.