Fork me on GitHub
#cursive
<
2020-05-27
>
Wilson Velez05:05:06

I’m trying to run the next test from cursive using the context menu REPL-> Run ‘init-test’ in REPL

(ns cljs-wew.core-test
  (:require [clojure.test :refer-macros [deftest is]]))

(deftest init-test
  (is (= 1 1)))
but I’m getting this message

cfleming05:05:19

Unfortunately, the Cursive test integration currently only works with Clojure, not CLJS.

Wilson Velez14:05:06

@U0567Q30W, oh, I see, is this something you are planning to add in the near future?

cfleming22:05:22

Well, in the future yes, no promises about when though.

Wilson Velez05:05:06

------ REPL Error while processing ---------------------------------------------
(clojure.core/with-redefs [clojure.test/do-report (clojure.core/fn [report__14957__auto__] (clojure.core/let [trace-info__14958__auto__ (clojure.core/fn [s__14959__auto__] {:file (.getFileName s__14959__auto__), :line (.getLineNumber s__14959__auto__), :class (.getClassName s__14959__auto__)}) file-info__14960__auto__ (clojure.core/fn [exception__14961__auto__ depth__14962__auto__] (trace-info__14958__auto__ (clojure.core/nth (.getStackTrace exception__14961__auto__) depth__14962__auto__))) test-file-info__14963__auto__ (clojure.core/fn [exception__14961__auto__] (trace-info__14958__auto__ (clojure.core/last (clojure.core/take-while (fn* [p1__14956__14964__auto__] (clojure.core/not (.startsWith (.getClassName p1__14956__14964__auto__) "clojure.test$"))) (.getStackTrace exception__14961__auto__))))) report__14957__auto__ (clojure.core/if-let [ns__14965__auto__ (:ns report__14957__auto__)] (clojure.core/assoc report__14957__auto__ :ns (clojure.core/ns-name ns__14965__auto__)) report__14957__auto__) report__14957__auto__ (clojure.core/case (:type report__14957__auto__) :pass (clojure.core/merge (file-info__14960__auto__ (java.lang.Throwable.) 1) report__14957__auto__) :fail (clojure.core/merge (file-info__14960__auto__ (java.lang.Throwable.) 1) report__14957__auto__) :error (clojure.core/merge (test-file-info__14963__auto__ (:actual report__14957__auto__)) report__14957__auto__) report__14957__auto__) report__14957__auto__ (clojure.core/if-let [var__14966__auto__ (:var report__14957__auto__)] (clojure.core/assoc (clojure.core/dissoc report__14957__auto__ :var) :ns (clojure.core/ns-name (:ns (clojure.core/meta var__14966__auto__))) :name (:name (clojure.core/meta var__14966__auto__)) :file (:file (clojure.core/meta var__14966__auto__)) :line (:line (clojure.core/meta var__14966__auto__)) :column (:column (clojure.core/meta var__14966__auto__))) report__14957__auto__) report__14957__auto__ (if (clojure.core/= :pass (:type report__14957__auto__)) (clojure.core/dissoc report__14957__auto__ :actual) report__14957__auto__) report__14957__auto__ (if (clojure.core/contains? report__14957__auto__ :actual) (clojure.core/let [actual__14967__auto__ (:actual report__14957__auto__) val__14968__auto__ (clojure.core/cond (clojure.core/class? actual__14967__auto__) (.getName actual__14967__auto__) (clojure.core/instance? java.lang.Throwable actual__14967__auto__) (do (clojure.core/require (quote clojure.stacktrace) (quote clojure.string)) (clojure.core/cond (clojure.core/find-ns (quote io.aviso.exception)) ((clojure.core/find-var (quote io.aviso.exception/write-exception)) actual__14967__auto__) (clojure.core/find-ns (quote clj-stacktrace.repl)) ((clojure.core/find-var (quote clj-stacktrace.repl/pst)) actual__14967__auto__) :else ((clojure.core/find-var (quote clojure.stacktrace/print-stack-trace)) actual__14967__auto__)) (clojure.core/-> (clojure.core/with-out-str (clojure.stacktrace/print-stack-trace (clojure.stacktrace/root-cause actual__14967__auto__) 5)) (clojure.string/replace "\n at " "\n") (clojure.string/replace "\n    " "\n"))) :else (clojure.core/pr-str actual__14967__auto__))] (clojure.core/assoc report__14957__auto__ :actual val__14968__auto__)) report__14957__auto__) report__14957__auto__ (if (clojure.core/contains? report__14957__auto__ :expected) (clojure.core/let [expected__14969__auto__ (:expected report__14957__auto__)] (clojure.core/assoc report__14957__auto__ :expected (clojure.core/pr-str expected__14969__auto__))) report__14957__auto__)] (clojure.core/when (clojure.core/and (clojure.core/= :fail (:type report__14957__auto__)) (clojure.core/contains? report__14957__auto__ :diffs) (clojure.core/find-ns (quote pjstadig.humane-test-output)) (clojure.core/not (java.lang.System/getenv "INHUMANE_TEST_OUTPUT")) (clojure.core/not (clojure.core/find-var (quote pjstadig.humane-test-output/cursive-warning)))) (clojure.core/binding [clojure.core/*out* clojure.core/*err*] (clojure.core/println "\nWARNING: pjstadig/humane-test-output appears to be active.") (clojure.core/println "This library interferes with Cursive's test functionality, in particular test result") (clojure.core/println "diffs. To fix this you can either disable it entirely, or set the INHUMANE_TEST_OUTPUT") (clojure.core/println "environment variable either in your lein/boot project or in your run configuration.\n") (clojure.core/intern (quote pjstadig.humane-test-output) (quote cursive-warning) true))) (clojure.test/with-test-out (clojure.core/print "@#Cursive#TestSupport#@" (clojure.core/pr-str report__14957__auto__)) (.flush clojure.test/*test-out*) (clojure.core/if-let [type__14970__auto__ (:type report__14957__auto__)] (clojure.test/inc-report-counter type__14970__auto__)))))] (clojure.test/run-tests (quote cljs-wew.core-test)))
Error in phase :compilation
Calls to `require` must appear at the top-level. at line 1 cljs_wew/core.cljs

Wilson Velez05:05:06

My project is a re-frame application, I’m using shadow-cljs to start my app and I’m using an nREPL from cursive to connect to it. I defined the environmental variable INHUMANE_TEST_OUTPUT that appears in the trace but it didn’t work. Is my setup the root of the problem or what I can do?

thheller08:05:18

@wvelezva that looks like cursive is sending CLJ code into the CLJS session. not sure why it would do that. which shadow-cljs version do you use? there were a couple versions where the session managed was messed up and broke the REPL.

cfleming09:05:46

That code probably doesn't have the CLJ/CLJS check, it should. Eval does, but I guess the test eval doesn't. That code probably predates the REPL knowing the difference.

Wilson Velez14:05:04

@U05224H0W I’m using shadow-cljs 2.9.10

Wilson Velez14:05:33

@U0567Q30W what do you mean by CLJ/CLJS check?

cfleming22:05:31

Cursive will check when sending forms that you're sending them to a REPL of the right type. Otherwise you get a message like this: https://twitter.com/yfjolne/status/1265569961038286848

cfleming22:05:50

But it looks like I don't have that check for the test integration - I'll add that.