{"action":"opened","issue":{"url":"https://api.github.com/repos/clojure-emacs/cider/issues/1825","repository_url":"https://api.github.com/repos/clojure-emacs/cider","labels_url":"https://api.github.com/repos/clojure-emacs/cider/issues/1825/labels{/name}","comments_url":"https://api.github.com/repos/clojure-emacs/cider/issues/1825/comments","events_url":"https://api.github.com/repos/clojure-emacs/cider/issues/1825/events","html_url":"https://github.com/clojure-emacs/cider/issues/1825","id":172021427,"number":1825,"title":"Show test.check's generated input for failing tests","user":{"login":"sebastianpoeplau","id":1150854,"avatar_url":"https://avatars.githubusercontent.com/u/1150854?v=3","gravatar_id":"","url":"https://api.github.com/users/sebastianpoeplau","html_url":"https://github.com/sebastianpoeplau","followers_url":"https://api.github.com/users/sebastianpoeplau/followers","following_url":"https://api.github.com/users/sebastianpoeplau/following{/other_user}","gists_url":"https://api.github.com/users/sebastianpoeplau/gists{/gist_id}","starred_url":"https://api.github.com/users/sebastianpoeplau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebastianpoeplau/subscriptions","organizations_url":"https://api.github.com/users/sebastianpoeplau/orgs","repos_url":"https://api.github.com/users/sebastianpoeplau/repos","events_url":"https://api.github.com/users/sebastianpoeplau/events{/privacy}","received_events_url":"https://api.github.com/users/sebastianpoeplau/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-18T23:09:03Z","updated_at":"2016-08-18T23:09:03Z","closed_at":null,"body":"CIDER nicely displays the expected and actual outcome for tests in the clojure.test framework. However, when the tests are based on test.check the output lacks information about the generated inputs.\r\n\r\nFor example, consider the following property:\r\n```clojure\r\n(defspec whatever\r\n  (prop/for-all [x gen/int]\r\n    (= 0 x)))\r\n```\r\n\r\nChecking it in CIDER yields this output:\r\n```\r\nFail in whatever\r\nexpected: result\r\n  actual: false\r\n```\r\n\r\nIt would be nice to also learn which `x` caused the test to fail. To this end, I would suggest to capture that very piece of information from the test.check results and display it in the result buffer whenever applicable.\r\n\r\nTechnically, the information about the failing input has to be propagated to `cider-nrepl.middleware.test/report`, where it could be stored and passed to the Emacs plugin for display. Unfortunately, `clojure.test.check.clojure-test.defspec` doesn't do so yet, [throwing away](https://github.com/clojure/test.check/blob/test.check-0.9.0/src/main/clojure/clojure/test/check/clojure_test.cljc#L16) everything except the success status, but the extension should be relatively simple. The utility library test.chuck already demonstrates a way to go: it [calls](https://github.com/gfredericks/test.chuck/blob/17ce0f1d86dc5f3bcef2a8f75df58a625dd3a101/src/com/gfredericks/test/chuck/clojure_test.cljc#L28) the report function, in our case `cider-nrepl.middleware.test/report`, with an event of `:type ::shrunk` when it has worked out the smallest failing inputs. As a first step, one might extend `cider-nrepl.middleware.test/report` to handle events of that type and have CIDER display the information in the result buffer. Then the same concept could be applied to test.check's `defspec`. I'll play around with it..."}}
{"actor":{"display_login":"sebastianpoeplau"}}