jakemcc / test-refresh

Refreshes and reruns clojure.tests in your project.
393 stars 28 forks source link

rerun just one namespace #41

Closed thirdreplicator closed 8 years ago

thirdreplicator commented 9 years ago

Is there a way to run just one namespace worth of tests at the command line like you can with

lein test com.example.test-widgets

It would be nice if we could do

lein test-refresh com.example.test-widgets

and have the tests keep running for that namespace.

jakemcc commented 9 years ago

Specifying a namespace currently isn't supported.

What you can do is add a :test-selector to your profiles.clj and then add metadata to the namespace you want to isolate.

If I want to do this I usually define a selector like :test-selectors {:focused :focused} in my project.clj. This allows me to add ^:focused to deftest or ns forms and only run those tests in by running lein test-refresh :focused.

thirdreplicator commented 9 years ago

That sounds pretty convenient. Do I have to restart (CTRL-C then lein test-refresh) if I move the ^:focused meta data to another test?

On Mon, Aug 31, 2015 at 9:10 AM, Jake McCrary notifications@github.com wrote:

Specifying a namespace currently isn't supported.

What you can do is add a :test-selector to your profiles.clj and then add metadata to the namespace you want to isolate.

If I want to do this I usually define a selector like :test-selectors {:focused :focused} in my project.clj. This allows me to add ^:focused to deftest or ns forms and only run those tests in by running lein test-refresh :focused.

— Reply to this email directly or view it on GitHub https://github.com/jakemcc/lein-test-refresh/issues/41#issuecomment-136417109 .

jakemcc commented 9 years ago

Nope, it will pick up on the changed metadata and run whatever currently matches the test selector function (in this case :focused)

You do have to start test refresh with the test selector you want to run though.

I'd like to add a hardcoded keyword that could be used to move you from running all your tests to running a subset of them but I just haven't gotten around to it. I think it would be useful though.

On Mon, Aug 31, 2015, 19:17 David B notifications@github.com wrote:

That sounds pretty convenient. Do I have to restart (CTRL-C then lein test-refresh) if I move the ^:focused meta data to another test?

On Mon, Aug 31, 2015 at 9:10 AM, Jake McCrary notifications@github.com wrote:

Specifying a namespace currently isn't supported.

What you can do is add a :test-selector to your profiles.clj and then add metadata to the namespace you want to isolate.

If I want to do this I usually define a selector like :test-selectors {:focused :focused} in my project.clj. This allows me to add ^:focused to deftest or ns forms and only run those tests in by running lein test-refresh :focused.

— Reply to this email directly or view it on GitHub < https://github.com/jakemcc/lein-test-refresh/issues/41#issuecomment-136417109

.

— Reply to this email directly or view it on GitHub https://github.com/jakemcc/lein-test-refresh/issues/41#issuecomment-136533661 .

jakemcc commented 8 years ago

Marking this as closed since it is mostly doable through :test-selectors