cursive icon indicating copy to clipboard operation
cursive copied to clipboard

cursive specific error when generating clojure.test tests with hyperfiddle/rcf

Open nottmey opened this issue 3 years ago • 0 comments

Cursive Version

1.12.2-2021.3

Reproduce via

Create Deps Project with deps.edn with content:

{:deps    {com.hyperfiddle/rcf {:mvn/version "20220405"}
           org.clojure/clojure {:mvn/version "1.11.1"}}
 :aliases {:test {:extra-paths ["test"]
                  :extra-deps  {io.github.cognitect-labs/test-runner {:git/tag "v0.5.0" :git/sha "b3fd0d2"}}
                  :main-opts   ["-m" "cognitect.test-runner" "-r" "bug-report-cursive.*"]
                  :exec-fn     cognitect.test-runner.api/test
                  :jvm-opts    ["-Dhyperfiddle.rcf.generate-tests=true"]}}}

and create Dir + Package + File test/bug_report_cursive/test.clj with content:

(ns bug-report-cursive.test
  (:require [clojure.test :refer [deftest is]]
            [hyperfiddle.rcf :refer [tests]]))

(deftest always-true
  (is true))

(tests
  "true is true"
  true := true)

Observe that clj -M:test works fine:

➜ clj -M:test

Running tests in #{"test"}

Testing bug-report-cursive.test
.✅.
Ran 2 tests containing 2 assertions.
0 failures, 0 errors.

Problem

When running clojure.test runner with Deps and alias test:

image

Observe that an error is thrown: image

.java.lang.ClassCastException: class java.lang.String cannot be cast to class clojure.lang.Symbol (java.lang.String is in module java.base of loader 'bootstrap'; clojure.lang.Symbol is in unnamed module of loader 'app')
 at clojure.core$find_ns.invokeStatic (core.clj:4127)
    clojure.core$the_ns.invokeStatic (core.clj:4161)
    clojure.core$ns_name.invokeStatic (core.clj:4165)
    clojure.core$ns_name.invoke (core.clj:4165)
    cursive.tests.runner$eval576$report__22180__auto____583.invoke (run-tests4375756379412654374.clj:81)
    clojure.test$do_report.invokeStatic (test.clj:357)
    clojure.test$do_report.invoke (test.clj:351)
    bug_report_cursive.test$fn__556.invokeStatic (test.clj:8)
    bug_report_cursive.test/fn (test.clj:8)
    clojure.test$test_var$fn__9856.invoke (test.clj:717)
    clojure.test$test_var.invokeStatic (test.clj:717)
    clojure.test$test_var.invoke (test.clj:708)
    cursive.tests.runner$test_vars$fn__190$fn__199.invoke (run-tests4375756379412654374.clj:36)
    clojure.test$default_fixture.invokeStatic (test.clj:687)
    clojure.test$default_fixture.invoke (test.clj:683)

Reminder: RCF is not intended to be used that way. But generally it should simply generate deftest macros, so this might be a hint that something is buggy.

(Also observe that, when you delete (deftest always-true ...) the RCF tests are not picked up -> "No tests where found")

nottmey avatar Apr 27 '22 23:04 nottmey