jakemcc / test-refresh

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

Tests as cljc #39

Closed donbonifacio closed 9 years ago

donbonifacio commented 9 years ago

Hello,

I migrated a project to cljc, and now test-refresh don't load any tests. Note that lein test also doesn't load them automatically, don't know if has anything to do with it. I'm still able to run all tests by requiring namespaces and with a test-runner.

jakemcc commented 9 years ago

@donbonifacio Can you try upgrading the linked project to use [com.jakemccrary/lein-test-refresh "0.10.0"]? I did this locally and the tests run.

(previously I had posted something here about it not running tests, I must have forgotten to save the project.clj file. When I tried again I see the tests running).

donbonifacio commented 9 years ago

I still can't have the tests loaded. Note that when I touch files, the output shows that the ns that I touched is reloaded. But still no tests are run.

I'm using lein profiles and the output follows. Not the the Testing user, that seams a bit off.

$ lein with-profile clj test-refresh
*********************************************
*************** Running tests ***************
:reloading (obb-rules.host-dependent obb-rules.laws obb-rules.units.boozer obb-rules.units.vector obb-rules.math obb-rules.units.nova obb-rules.units.heavy-seeker obb-rules.units.pretorian obb-rules.units.worm obb-rules.units.toxic obb-rules.units.kamikaze obb-rules.units.anubis obb-rules.units.rain obb-rules.units.scarab obb-rules.units.raptor obb-rules.units.fenix obb-rules.units.kahuna obb-rules.units.krill obb-rules.units.driller obb-rules.units.eagle obb-rules.units.doomer obb-rules.units.crusader obb-rules.units.panther obb-rules.unit obb-rules.element obb-rules.simplifier obb-rules.board obb-rules.translator obb-rules.stash obb-rules.result obb-rules.game obb-rules.game-mode obb-rules.actions.rotate obb-rules.actions.damage-calculator obb-rules.actions.direction obb-rules.actions.triple-attack obb-rules.actions.move-restrictions obb-rules.actions.move obb-rules.actions.goto obb-rules.actions.deploy obb-rules.auto-deploys.common obb-rules.auto-deploys.firingsquad obb-rules.actions.auto-deploy obb-rules.actions.rebound obb-rules.actions.strikeback obb-rules.actions.hooks obb-rules.actions.attack obb-rules.action obb-rules.turn obb-rules.evaluator obb-rules.generators obb-rules.evaluator-test obb-rules.ai.common obb-rules.ai.acts-as-bot-test obb-rules.ai.firingsquad obb-rules.ai.firingsquad-test obb-rules.action-test obb-rules.privatize obb-rules.actions.triple-attack-test obb-rules.ai.common-test obb-rules.board-test obb-rules.actions.attack-test obb-rules.privatize-test obb-rules.actions.rotate-test obb-rules.actions.catapult-test obb-rules.actions.deploy-test obb-rules.actions.rebound-test obb-rules.env-test obb-rules.game-mode-test obb-rules.actions.move-test obb-rules.simplifier-test obb-rules.stash-test obb-rules.element-test obb-rules.translator-test obb-rules.actions.bonus-test obb-rules.actions.direction-test obb-rules.actions.damage-calculator-test obb-rules.game-test obb-rules.actions.strikeback-test obb-rules.actions.goto-test obb-rules.unit-test obb-rules.actions.auto-deploy-test obb-rules.test-requires obb-rules.test-runner obb-rules.main)
WARNING: update already refers to: #'clojure.core/update in namespace: obb-rules.actions.direction, being replaced by: #'obb-rules.actions.direction/update

Testing user

Ran 0 tests containing 0 assertions.
0 failures, 0 errors.

Passed all tests
Finished at 20:48:02.036 (run time: 1.806s)
jakemcc commented 9 years ago

@donbonifacio Can you try running lein with-profile +clj test-refresh and lein-test-refresh 0.10.0? With the + I end up seeing tests run (which is running with the default profiles and clj profile).

donbonifacio commented 9 years ago

With +clj no cljc namespaces are loaded

$ lein with-profile +clj test-refresh
*********************************************
*************** Running tests ***************
:reloading (obb-rules.test-runner)

Ran 0 tests containing 0 assertions.
0 failures, 0 errors.

Passed all tests
Finished at 21:10:00.269 (run time: 2.329s)
jakemcc commented 9 years ago

Hmm, weird.

Here are some things that might be worth checking to see what the difference is.

$ lein version
Leiningen 2.5.1 on Java 1.8.0_45 Java HotSpot(TM) 64-Bit Server VM

Removed all my customizations from my ~/.lein directory to make sure there wasn't something from my profiles.clj that was making this work.

$ ls -la ~/.lein/
total 0
drwxr-xr-x    3 jake  staff   102 Jul  6 15:27 .
drwxr-xr-x+ 214 jake  staff  7276 Jul  6 15:27 ..
drwxr-xr-x    4 jake  staff   136 Feb 21 15:03 self-installs
$ git diff
diff --git a/project.clj b/project.clj
index f57c8a8..bec3396 100644
--- a/project.clj
+++ b/project.clj
@@ -27,7 +27,7 @@

      :clj {

-       :plugins [[com.jakemccrary/lein-test-refresh "0.9.0"]
+       :plugins [[com.jakemccrary/lein-test-refresh "0.10.0"]
                  [lein-cloverage "1.0.2"]]

        :main obb-rules.test-runner}
$ lein with-profile +clj test-refresh
*********************************************
*************** Running tests ***************
:reloading (obb-rules.host-dependent obb-rules.laws obb-rules.units.boozer obb-rules.units.vector obb-rules.math obb-rules.units.nova obb-rules.units.heavy-seeker obb-rules.units.pretorian obb-rules.units.worm obb-rules.units.toxic obb-rules.units.kamikaze obb-rules.units.anubis obb-rules.units.rain obb-rules.units.scarab obb-rules.units.raptor obb-rules.units.fenix obb-rules.units.kahuna obb-rules.units.krill obb-rules.units.driller obb-rules.units.eagle obb-rules.units.doomer obb-rules.units.crusader obb-rules.units.panther obb-rules.unit obb-rules.element obb-rules.simplifier obb-rules.board obb-rules.translator obb-rules.stash obb-rules.result obb-rules.game obb-rules.game-mode obb-rules.actions.rotate obb-rules.actions.damage-calculator obb-rules.actions.direction obb-rules.actions.triple-attack obb-rules.actions.move-restrictions obb-rules.actions.move obb-rules.actions.goto obb-rules.actions.deploy obb-rules.auto-deploys.common obb-rules.auto-deploys.firingsquad obb-rules.actions.auto-deploy obb-rules.actions.rebound obb-rules.actions.strikeback obb-rules.actions.hooks obb-rules.actions.attack obb-rules.action obb-rules.turn obb-rules.evaluator obb-rules.generators obb-rules.evaluator-test obb-rules.ai.common obb-rules.ai.acts-as-bot-test obb-rules.ai.firingsquad obb-rules.ai.firingsquad-test obb-rules.action-test obb-rules.privatize obb-rules.actions.triple-attack-test obb-rules.ai.common-test obb-rules.board-test obb-rules.actions.attack-test obb-rules.privatize-test obb-rules.actions.rotate-test obb-rules.actions.catapult-test obb-rules.actions.deploy-test obb-rules.actions.rebound-test obb-rules.env-test obb-rules.game-mode-test obb-rules.actions.move-test obb-rules.simplifier-test obb-rules.stash-test obb-rules.element-test obb-rules.translator-test obb-rules.actions.bonus-test obb-rules.actions.direction-test obb-rules.actions.damage-calculator-test obb-rules.game-test obb-rules.actions.strikeback-test obb-rules.actions.goto-test obb-rules.unit-test obb-rules.actions.auto-deploy-test obb-rules.test-requires obb-rules.test-runner obb-rules.main)
WARNING: update already refers to: #'clojure.core/update in namespace: obb-rules.actions.direction, being replaced by: #'obb-rules.actions.direction/update

Testing obb-rules.action-test

<much more testing output>

Ran 163 tests containing 1049 assertions.
0 failures, 0 errors.

Passed all tests
Finished at 15:30:32.319 (run time: 2.350s)

Something that might be worth trying is adding an explicit [org.clojure/tools.namespace "0.2.11"] dependency to the clj section of your project.clj. This is the version the latest (0.10.0) test-refresh requires for picking up cljc files. There might be another dependency requiring an earlier release that is causing problems.

donbonifacio commented 9 years ago

Well, did a lein clean, added the explicit ref to tools.namespace, and with +cljc is now working. :)

Thanks!

jakemcc commented 9 years ago

Awesome, great to hear!

On Mon, Jul 6, 2015 at 3:59 PM, Pedro Santos notifications@github.com wrote:

Well, did a lein clean, added the explicit ref to tools.namespace, and with +cljc is now working. :)

Thanks!

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

donbonifacio commented 9 years ago

For the record, I added lein-ancient as a plugin on my profiles and now all projects were having problems with lein-test-refresh. I had to explicitly add [org.clojure/tools.namespace "0.2.11"] for them to work.

I'm closing this.