Skip to content
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

Support for selectors in the repl? #64

Open
glenjamin opened this issue Feb 22, 2019 · 4 comments
Open

Support for selectors in the repl? #64

glenjamin opened this issue Feb 22, 2019 · 4 comments

Comments

@glenjamin
Copy link

I would quite like to run all tests, excluding some integration tests from the repl.

At the moment it looks like all of the selector logic is in the lein plugin. Would it be possible to move the filtering logic into the repl side, even if the selector configuration needs to stay in the plugin?

(also: thanks for making this, it's great!)

@weavejester
Copy link
Owner

What sort of filtering logic would be moved? Current you can insert a filter directly at the REPL:

(->> (find-tests "test") (filter whatever?) (run-tests))

I believe you can also use (filter (comp #{:tag} meta)) to filter on a particular metadata tag.

@glenjamin
Copy link
Author

Oh, I hadn't realised it was that simple - I glanced at the code in https://github.com/weavejester/eftest/blob/master/lein-eftest/src/leiningen/eftest.clj#L24 and my eyes wen't fuzzy 😄

@glenjamin
Copy link
Author

glenjamin commented Feb 22, 2019

Ok, I ended up doing something like this, which feels a little bit wordy.

(as-> (find-tests "test") ts
 (filter (complement (comp :integration meta)) ts)
 (run-tests ts {:multithread? false}))

There are probably better ways to shuffle the arguments around, but my clojure is a bit rusty.

I'm not sure if putting this into the lib itself would be a big improvement, or where it would go if it was attempted.

(edit: I should add that at the moment I'm using this via a local profile, and not adding anything into the project for its other contributors, if we decide to all use it I could add a simple wrapper fn easily enough)

@weavejester
Copy link
Owner

weavejester commented Feb 22, 2019

I'm tentatively of the opinion that a function like this could be added to your development environment. Perhaps something like:

(ns user
  (:require [eftest.runner :as ef]))

(defn run-tests []
  (as-> (ef/find-tests "test") ts
   (filter (complement (comp :integration meta)) ts)
   (ef/run-tests ts {:multithread? false}))

You could also play around with a wrapper that accepts a transducer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants