{"id":15733086,"url":"https://github.com/borkdude/speculative-kaocha-plugin","last_synced_at":"2025-03-13T05:31:18.088Z","repository":{"id":62434703,"uuid":"168379998","full_name":"borkdude/speculative-kaocha-plugin","owner":"borkdude","description":"speculative kaocha plugin","archived":false,"fork":false,"pushed_at":"2019-02-08T10:07:20.000Z","size":20,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-01T20:30:14.132Z","etag":null,"topics":["clojure","clojure-spec","testing"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/borkdude.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-30T16:56:08.000Z","updated_at":"2019-09-25T13:09:34.000Z","dependencies_parsed_at":"2022-11-01T21:15:52.521Z","dependency_job_id":null,"html_url":"https://github.com/borkdude/speculative-kaocha-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borkdude%2Fspeculative-kaocha-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borkdude%2Fspeculative-kaocha-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borkdude%2Fspeculative-kaocha-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borkdude%2Fspeculative-kaocha-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/borkdude","download_url":"https://codeload.github.com/borkdude/speculative-kaocha-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243351219,"owners_count":20276894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","clojure-spec","testing"],"created_at":"2024-10-04T00:40:56.115Z","updated_at":"2025-03-13T05:31:17.838Z","avatar_url":"https://github.com/borkdude.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://raw.githubusercontent.com/borkdude/speculative/master/logo/favicon-160.png\"\u003e\n\n# speculative kaocha plugin\n\n[![Clojars Project](https://img.shields.io/clojars/v/speculative/kaocha-plugin.svg)](https://clojars.org/speculative/kaocha-plugin)\n[![cljdoc badge](https://cljdoc.org/badge/speculative/kaocha-plugin)](https://cljdoc.org/d/speculative/kaocha-plugin/CURRENT)\n\nThis [kaocha](https://github.com/lambdaisland/kaocha) plugin instruments tests\nwith [speculative](https://github.com/borkdude/speculative) clojure.core specs.\n\n## Installation\n\n### Tools.deps\n\n``` clojure\n{:deps {speculative/kaocha-plugin {:mvn/version \"0.0.1\"}}}\n```\n\n### Leiningen / Boot\n\n``` clojure\n[speculative/kaocha-plugin \"0.0.1\"]\n```\n\n## Configuration\n\nAdd `:speculative-kaocha.plugin/instrument` to the `:plugins` key in\n`tests.edn`. \n\nBy default `clojure.core` functions are instrumented. This can be disabled by\nsetting `:speculative-kaocha.plugin/no-instrument` to `true` on a per test suite\nbasis.\n\n``` clojure\n#kaocha/v1\n{:plugins [:speculative-kaocha.plugin/instrument]\n :tests [{:id :unit\n          :kaocha/test-paths    [\"test/unit\"]}\n         {:id :integration\n          :speculative-kaocha.plugin/no-instrument true\n          :kaocha/test-paths    [\"test/integration\"]}]}\n```\n\n## Demo\n\n``` clojure\n$ cat test/demo/core_test.cljc\n(ns demo.core-test\n  (:require [clojure.test :as t]))\n\n(t/deftest foo\n  (t/is (flatten 1)))\n\n$ clojure -A:test -m kaocha.runner\n[(.)]\n1 tests, 1 assertions, 0 failures.\n\n$ clojure -A:test -m kaocha.runner --plugin speculative-kaocha.plugin/instrument\n[(E)]\nRandomized with --seed 1206313428\n\nERROR in demo.core-test/foo (alpha.clj:132)\nException: clojure.lang.ExceptionInfo: Call to #'clojure.core/flatten did not conform to spec.\n{:clojure.spec.alpha/problems [{:path [:x :clojure.spec.alpha/pred], :pred clojure.core/sequential?, :val 1, :via [:speculative.specs/sequential], :in [0]} {:path [:x :clojure.spec.alpha/nil], :pred nil?, :val 1, :via [], :in [0]}], :clojure.spec.alpha/spec #object[clojure.spec.alpha$regex_spec_impl$reify__2509 0x76596288 \"clojure.spec.alpha$regex_spec_impl$reify__2509@76596288\"], :clojure.spec.alpha/value (1), :clojure.spec.alpha/fn clojure.core/flatten, :clojure.spec.alpha/args (1), :clojure.spec.alpha/failure :instrument, :clojure.spec.test.alpha/caller {:file \"core.clj\", :line 665, :var-scope clojure.core/apply}}\n```\n\n## Selectively disabling specs\n\nIn the unfortunate event that a speculative spec is wrong, or your code is\noffending a spec and you don't want to fix it right away, you can selectively\ndisable specs by `def`'ing them to `nil` after loading `speculative.instrument`.\n\nE.g. `(s/def clojure.core/re-find nil)`.\n\nIn `deps.edn` this can be done as follows:\n\n``` clojure\n:main-opts\n[\"-e\" \"(require,'[speculative.instrument])\"\n \"-e\" \"(require,'[clojure.spec.alpha,:as,s])\"\n \"-e\" \"(s/def,clojure.core/re-find,nil)\"\n \"-m\" \"kaocha.runner\" \"--no-capture-output\"]\n```\n\n## Tests\n\n    clojure -A:test\n    lein kaocha\n\n## License\n\nCopyright © 2018 Michiel Borkent\n\nDistributed under the EPL License, same as Clojure. See LICENSE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborkdude%2Fspeculative-kaocha-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborkdude%2Fspeculative-kaocha-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborkdude%2Fspeculative-kaocha-plugin/lists"}