Skip to content

Large test result previews don't display #2032

@conan

Description

@conan

When my deftest tests fail, Cursive often can't show the results. Instead of popping up the overlay with the test results when I hover over the is form, the cursor rapidly switches back and forth between a hand and an arrow, and the results are never displayed. This seems to happen when testing function specs using clojure.spec.test.alpha/check using inputs with large amounts of spec, which are therefore generating large diffs between the values.

I'm not able to find a small reproduction, but here's the test infrastructure:

(defn check
  "Passes sym to stest/check with a :max-size option of 3 (i.e. generated sequences will have no more than 3 elements,
   returning true if the test passes or the explained error if not"
  [sym]
  (-> (stest/check sym {:clojure.spec.test.check/opts {:max-size 3}})
      first ;; stest/check accepts a variable number of syms, this does not
      :clojure.spec.test.check/ret
      :result))

;; a function with args and ret specs
(defn a-fn
  [a b]
  ...
  )

(s/fdef a-fn
  :args (s/cat :a :something/big :b :something/bigger)
  :ret :something/huge)

;; at test
(deftest a-fn-test
  (is (true? (check `a-fn))))

I've done it this way so I can exercise my function specs, getting either a true result or the error displayed. Problem is, Cursive won't display the error except in trivial cases. I'm sorry I can't create a short reproduction, I think the issue is related to the length of the preview output; a stack trace is usually fine (although sometimes I get the flicker for a few seconds before the preview appears), but a large generated spec diff always fails.

I seem to recall that pointing at the exclamation mark in the left margin would previously show the diff, but that no longer seems to happen so I have to point at the is form, which is where I experience this problem.

Update: I just noticed that pointing to the little red line in the margin near the scroll bar displays the results correctly, although it doesn't give me a link to view the diff when viewing it that way. There is a scroll bar in the popup to navigate the output, but I can't figure out how I would use it because if I move the mouse then the preview disappears, and any keypress also makes it disappear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugMarks issues describing bugsreleasedMarks issues which have had the fixes released in a stable build

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions