-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not reloading file when repeatedly finding tests #57
Comments
Reloading files is outside the scope of the function, and it's better to use a library like tools.namespace or some other namespace tracker/reloader to handle it. |
I guess I wonder how useful it is to use in the REPL if it can’t discover new or modified tests in existing files. Without auto-running (test-refresh style), the REPL is the best means of quickly checking the tests. However, if you feel this is outside the scope of the library, I guess that’s that and I’ll just create a wrapper for this functionality. |
If we were to add functionality like this in, then it would need to be a new function, and essentially it would be a wrapper of the Using |
Bat-test contains implementation of tools.namespace eftest integration: https://github.com/metosin/bat-test/blob/master/src/metosin/bat_test/impl.clj#L127 The code uses low level c.t.n functions (dir and track namespaces) of so that it can also use the changed file information to only run tests in the changed namespaces. Important parts are
Currently bat-test doesn't contain REPL API but I've been thinking about that: metosin/bat-test#21 |
Your implementation is more complex than the one I was thinking of: (def test-path "test")
(defn test-dir []
(run-tests (find-tests test-path))
(defn refresh-and-test []
(require-namespaces-in-dir test-path)
(repl/refresh :after `test-path)) With some additional functions for setting a REPL test path. |
Yes, bat-test code is more complex as it uses lower level c.t.n. functions so it can only run tests in the changed namespaces. |
Currently,
require-namespaces-in-dir
doesn't reload the vars in a given namespace or directory of namespaces. This is an issue when running tests from a REPL andfind-tests
doesn't see new or modified tests.This line is the issue. If
(require ns)
were to be instead,(require (into [] (concat ns [:reload :all])))
, it would (probably) fix the issue and find new and updated tests.Unless I've missed something, in which case, anyone care to tell me how to do this?
The text was updated successfully, but these errors were encountered: