{"action":"created","issue":{"url":"https://api.github.com/repos/gfredericks/test.chuck/issues/59","repository_url":"https://api.github.com/repos/gfredericks/test.chuck","labels_url":"https://api.github.com/repos/gfredericks/test.chuck/issues/59/labels{/name}","comments_url":"https://api.github.com/repos/gfredericks/test.chuck/issues/59/comments","events_url":"https://api.github.com/repos/gfredericks/test.chuck/issues/59/events","html_url":"https://github.com/gfredericks/test.chuck/issues/59","id":352340966,"node_id":"MDU6SXNzdWUzNTIzNDA5NjY=","number":59,"title":"Should catch unexpected exceptions and fail the test suite","user":{"login":"metametadata","id":4689913,"node_id":"MDQ6VXNlcjQ2ODk5MTM=","avatar_url":"https://avatars3.githubusercontent.com/u/4689913?v=4","gravatar_id":"","url":"https://api.github.com/users/metametadata","html_url":"https://github.com/metametadata","followers_url":"https://api.github.com/users/metametadata/followers","following_url":"https://api.github.com/users/metametadata/following{/other_user}","gists_url":"https://api.github.com/users/metametadata/gists{/gist_id}","starred_url":"https://api.github.com/users/metametadata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metametadata/subscriptions","organizations_url":"https://api.github.com/users/metametadata/orgs","repos_url":"https://api.github.com/users/metametadata/repos","events_url":"https://api.github.com/users/metametadata/events{/privacy}","received_events_url":"https://api.github.com/users/metametadata/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-08-21T00:23:19Z","updated_at":"2018-09-24T00:09:49Z","closed_at":null,"author_association":"NONE","body":"**Example:**\r\n\r\n```clj\r\n(ns unit.a.b\r\n  (:require \r\n    [clojure.test.check.generators :as gen]\r\n    [com.gfredericks.test.chuck.clojure-test :as chuck]\r\n    [clojure.test :as ct :refer :all]))\r\n\r\n(deftest foo\r\n  (chuck/checking\r\n    \"bar\"\r\n    10\r\n    [x gen/int]\r\n    (throw (ex-info \"oops\" {}))))\r\n```\r\n\r\n**Expected:**\r\n\r\n```\r\n<somehow report the exception with stacktrace>\r\n...\r\n0 failures, 1 errors.\r\nTests failed.\r\n```\r\n\r\n**Actual:**\r\n\r\n```\r\nTests failed, smallest case: [{x 0}] \r\nSeed 1534810136116\r\n\r\nRan 1 tests containing 0 assertions.\r\n0 failures, 0 errors.\r\n```\r\n\r\nMy current **workaround** is to redefine the reporting method so that it always \"fails\" the test via `(is false)`:\r\n\r\n```clj\r\n(defmethod ct/report ::chuck/shrunk\r\n  [m]\r\n  (is false \"Property test failed, see logs for more info\")\r\n  (println\r\n    ;\"\\nCase:\\n\" (with-out-str (pp/pprint (:fail m)))\r\n    \"\\nShrunk:\\n\" (with-out-str (pp/pprint (-> m :shrunk :smallest)))\r\n    (str \"\\n(num-tests: \" (:num-tests m)\r\n         \", total-nodes-visited: \" (-> m :shrunk :total-nodes-visited)\r\n         \", depth: \" (-> m :shrunk :depth)\r\n         \", failing-size: \" (:failing-size m)\r\n         \", seed: \" (:seed m) \")\"))\r\n  (println \"Error:\" (pr-str (-> m :result-data :clojure.test.check.properties/error))))\r\n```\r\n\r\nOutput:\r\n\r\n```\r\nFAIL in (foo) (b.clj:21)\r\nbar\r\nProperty test failed, see logs for more info\r\nexpected: false\r\n  actual: false\r\n\r\nShrunk:\r\n [{x 0}]\r\n \r\n(num-tests: 1, total-nodes-visited: 0, depth: 0, failing-size: 0, seed: 1534810550729)\r\nError: #error {\r\n :cause \"oops\"\r\n :data {}\r\n :via\r\n [{:type clojure.lang.ExceptionInfo\r\n   :message \"oops\"\r\n   :data {}\r\n   :at [clojure.core$ex_info invokeStatic \"core.clj\" 4739]}]\r\n :trace\r\n [[clojure.core$ex_info invokeStatic \"core.clj\" 4739]\r\n  [clojure.core$ex_info invoke \"core.clj\" 4739]\r\n  ...]}\r\n\r\nRan 1 tests containing 1 assertions.\r\n1 failures, 0 errors.\r\nTests failed.\r\n```\r\n\r\nWorkaround  output for the expected failure:\r\n\r\n```clj\r\n(deftest foo\r\n  (chuck/checking\r\n    \"bar\"\r\n    1000\r\n    [x gen/int]\r\n    (is (not= 5 x))))\r\n```\r\n\r\n```\r\nlein test :only unit.a.b/foo\r\n\r\nFAIL in (foo) (b.clj:21)\r\nbar\r\nProperty test failed, see logs for more info\r\nexpected: false\r\n  actual: false\r\n\r\nShrunk:\r\n [{x 5}]\r\n \r\n(num-tests: 114, total-nodes-visited: 3, depth: 0, failing-size: 113, seed: 1534810835278)\r\nError: nil\r\n\r\nlein test :only unit.a.b/foo\r\n\r\nFAIL in (foo) (b.clj:179)\r\nbar\r\nexpected: (not= 5 x)\r\n  actual: (not (not= 5 5))\r\n\r\nRan 1 tests containing 2 assertions.\r\n2 failures, 0 errors.\r\nTests failed.\r\n```"},"comment":{"url":"https://api.github.com/repos/gfredericks/test.chuck/issues/comments/423858296","html_url":"https://github.com/gfredericks/test.chuck/issues/59#issuecomment-423858296","issue_url":"https://api.github.com/repos/gfredericks/test.chuck/issues/59","id":423858296,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzg1ODI5Ng==","user":{"login":"gfredericks","id":135443,"node_id":"MDQ6VXNlcjEzNTQ0Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/135443?v=4","gravatar_id":"","url":"https://api.github.com/users/gfredericks","html_url":"https://github.com/gfredericks","followers_url":"https://api.github.com/users/gfredericks/followers","following_url":"https://api.github.com/users/gfredericks/following{/other_user}","gists_url":"https://api.github.com/users/gfredericks/gists{/gist_id}","starred_url":"https://api.github.com/users/gfredericks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfredericks/subscriptions","organizations_url":"https://api.github.com/users/gfredericks/orgs","repos_url":"https://api.github.com/users/gfredericks/repos","events_url":"https://api.github.com/users/gfredericks/events{/privacy}","received_events_url":"https://api.github.com/users/gfredericks/received_events","type":"User","site_admin":false},"created_at":"2018-09-24T00:09:49Z","updated_at":"2018-09-24T00:09:49Z","author_association":"OWNER","body":"Is this something you can help with with a pull request?"}}
{"actor":{"display_login":"gfredericks"}}