Skip to content

Testing contexts are not shown anywhere in case of test failure #2605

@jeff303

Description

@jeff303

Testing contexts (see here, here, and here) are useful for pinpointing what causes failures in clojure.test cases. It seems that when running tests through Cursive (i.e. the Run ... in REPL action), this information is not available anywhere in the output (either in the REPL output window, or in the error markers showing the diffs).

Consider the following

;; buggy on purpose
(defn- is-even? [x]
  (> x 17))

(t/deftest contexts-test
  (t/testing "is-even? works as expected"
    (doseq [[exp val] [[true 2]
                       [false 17]
                       [true 100]]]
      (t/testing (format "%d produces %b" val exp)
        (t/is (= exp (is-even? val)))))))

When deps.edn is set up with the Cognitect test runner, as outlined here, the output of clj -X:test shows them, ex:

Testing my.project.whatever-test

FAIL in (contexts-test) (engine_test.clj:25)
is-even? works as expected (2 produces true)
expected: (= exp (is-even? val))
  actual: (not (= true false))

Contrast with the local REPL output shown in Cursive

Running my.project.whatever-test/contexts-test
Ran 1 test containing 3 assertions.
1 failure, 0 errors.

Notice the contexts do not show up anywhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions