bensu / doo

doo is a library and lein plugin to run cljs.test on different js environments.
Eclipse Public License 1.0
324 stars 63 forks source link

Run set of explicit tests only #9

Open crisptrutski opened 9 years ago

crisptrutski commented 9 years ago

It would be convenient to be able to run only specific tests, rather than whole namespaces. This would be particularly useful with downstream tooling eg. rerunning failing tests first on save, or only the tests that call the given function.

Expect the method would take vars, ie. (doo-test-vars #'ns/test-1 #'ns/test-2), as I don't believe something like resolve exists in Clojurescript.

bensu commented 9 years ago

I've thought about the following:

lein doo slimer test only ns/test-1 ns/test-2

lein doo slimer test only ns1 ns2

Would that cover your needs? Otherwise, we can always extend doo's api to have doo-test-vars and doo-test-var in place of cljs.test/test-vars and cljs,test/test-var.

bensu commented 9 years ago

We'll add support for doo-test-vars and doo-test-var when cljs-1267 is finalized. The only option from the command line will be treated separately.

cldwalker commented 9 years ago

Seems cljs-1267 issue has landed. Would be great to have this! @bensu If you don't have cycles for this let us know and hopefully one of us can get to it

bensu commented 9 years ago

Thanks @cldwalker, I forgot about this.

Before encouraging you to go for it, I must warn you that it is not as straight forward as it sounds for three reasons:

  1. The report events are different for each of function cljs.test/test-var, cljs.test/test-vars, cljs.test/run-tests (the reason why in CLJS-1267 I wanted to keep them the same was to facilitate this future!)
  2. Right now, there can only be one top level form. Now that there is a fine level of granularity, it might be desirable to have several, as in (doo-test-var 'one.ns/test) followed by (doo-run-tests 'other.ns 'yet-another.ns). How should that be implemented? For this feature, I would keep it as it is, with only one top level doo form.
  3. Having to define new cljs.test/report multimethods will make #43 hader, or when implementing that, the work for this will be refactored.

So, having those three things in mind, I encourage anybody who wants to give it a shot, provided that they understand that the work might be somewhat refactored in the future due to 2 and 3. Otherwise I'll handle this myself after sorting out all bug/setup issues.