jakemcc / test-refresh

Refreshes and reruns clojure.tests in your project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refresh stops when encountering a circular dependency

kennethkalmer opened this issue · comments

When I create a circular dependency during refactoring (more often than I'd like to admit), test-refresh just stops and I need to restart it completely. The stacktrace printed to the console looks something like this:

Exception in thread "main" java.lang.Exception: Circular dependency between ns.one and ns.two, compiling:(/private/var/folders/20/n648ws_s0qj1kpdjq_v5vtgc0000gn/T/form-init2751876959826785001.clj:1:125)
    at clojure.lang.Compiler.load(Compiler.java:7391)
    at clojure.lang.Compiler.loadFile(Compiler.java:7317)
    at clojure.main$load_script.invokeStatic(main.clj:275)
    at clojure.main$init_opt.invokeStatic(main.clj:277)
    at clojure.main$init_opt.invoke(main.clj:277)
    at clojure.main$initialize.invokeStatic(main.clj:308)
    at clojure.main$null_opt.invokeStatic(main.clj:342)
    at clojure.main$null_opt.invoke(main.clj:339)
    at clojure.main$main.invokeStatic(main.clj:421)
    at clojure.main$main.doInvoke(main.clj:384)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:383)
    at clojure.lang.AFn.applyToHelper(AFn.java:156)
    at clojure.lang.Var.applyTo(Var.java:700)
    at clojure.main.main(main.java:37)

When I start it up again the exception is more useful to help trace down the circular dependency and get it fixed.

Sorry for not replying earlier but thanks for bringing this up. Its definitely an issue that with some types of reloading problems test-refresh stops refreshing.

There are some other non-test-refresh things I need to finish before I'll get a chance to look into this problem. I've been aware of this problem for a while (who doesn't accidentally introduce a circular dependency every once in a while) but I can't remember if I attempted to fix it at one point and failed or just deprioritized looking into a fix.

@kennethkalmer What version of lein-test-refresh are you using? I went to look into this today and was unable to recreate using the latest (0.18.0). Looks like it already was fixed!

I was on 0.16.0. Bumping and carrying on, thanks for the feedback!

@kennethkalmer Just caught a problem with the 0.18.0 release. Released 0.18.1 that fixes the problem.