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?
That’s what I was doing, @noisesmith, but I wanted to avoid forcing every other developer on this project to do the same
I ended up putting my dependency into the :dev
profile vector like @jumar 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.
loading all test namespaces is one of the behaviors of the test profile isn't it?
I don’t know. But I wasn’t explicitly running the test profile.
Why not adding them to the :dev
profile? I mean, I'd definitely want my tests to be available in the REPL.
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.
Good point. I’ll see if that makes sense in this project 🙂 Thanks!
Do you know if there’s a way to exclude stuff, though?
Sure, the :exclusions
keyword: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L55
yeah, but I mean ns’es in the project
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.
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...
Hm. That’s what I tought, too. Perhaps there’s something requiring our test ns’es dynamically.
(I get the dependency error at repl startup time)
I usually use lein with-profile +test repl
myself, but putting them under dev
is definitely more elegant...