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

How to use RCF with leiningen #53

Open
dustingetz opened this issue Apr 24, 2022 · 5 comments
Open

How to use RCF with leiningen #53

dustingetz opened this issue Apr 24, 2022 · 5 comments

Comments

@dustingetz
Copy link
Member

dustingetz commented Apr 24, 2022

Question is: "Basically just be able to use RCF with lein. It would be great if i can 'lein test' and it works."

@StankovicMarko
Copy link

StankovicMarko commented Apr 24, 2022

Solution from slack: https://clojurians.slack.com/archives/C7Q9GSHFV/p1650824587456189

; project.clj
:test-paths ["test"]
  :profiles {
             :test {:jvm-opts ["-Dhyperfiddle.rcf.generate-tests=true"]
                    :aliases {"run-tests" ["run" "-m" "app.core-test/run-tests" :project/test-paths]}}
             }

;app_test.clj
(ns app.core-test
  (:require [clojure.test :as test]
            [app.config]))

(defn run-tests [args]
  (test/run-tests 'app.config))

;how to run it (terminal)
lein with-profile test run-tests

; references
; https://github.com/technomancy/leiningen/blob/master/doc/PLUGINS.md#not-writing-a-plugin-%E6%97%A0%E4%B8%BA
; https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md

I'd be happy to learn about better/cleaner way to do this.
At the moment this approach works for my needs.

Thanks for sharing this!

@ggeoffrey
Copy link
Member

A minimal project.clj:

(defproject my/project "0.0.0"
  :dependencies [[org.clojure/clojure "1.10.3"]]
  :profiles {:test {:dependencies [[com.hyperfiddle/rcf "20220405"]]
                    :jvm-opts ["-Dhyperfiddle.rcf.generate-tests=true"]}})

Then run lein test

If you have tests forms in your src folder:

(defproject my/project "0.0.0"
  :dependencies [[org.clojure/clojure "1.10.3"]
                 [com.hyperfiddle/rcf "20220405"]]
  :profiles {:test {:jvm-opts ["-Dhyperfiddle.rcf.generate-tests=true"]
                    :test-paths ["test" "src"]}})

@StankovicMarko
Copy link

Oh wow, it's obvious now. Thanks a lot :)

@ieugen
Copy link
Contributor

ieugen commented Aug 11, 2022

I would love for this to be documented for newbies like me :)

@dustingetz
Copy link
Member Author

Reopening to add to readme

@dustingetz dustingetz reopened this Aug 12, 2022
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

4 participants