{"id":22859793,"url":"https://github.com/weavejester/eftest","last_synced_at":"2025-05-15T09:05:01.335Z","repository":{"id":36197074,"uuid":"40501296","full_name":"weavejester/eftest","owner":"weavejester","description":"Fast and pretty Clojure test runner","archived":false,"fork":false,"pushed_at":"2024-05-24T20:44:10.000Z","size":273,"stargazers_count":426,"open_issues_count":22,"forks_count":41,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-31T15:05:28.894Z","etag":null,"topics":["clojure","test-runner","testing"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weavejester.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-08-10T19:20:20.000Z","updated_at":"2025-03-24T07:29:55.000Z","dependencies_parsed_at":"2024-06-18T17:12:54.198Z","dependency_job_id":null,"html_url":"https://github.com/weavejester/eftest","commit_stats":{"total_commits":170,"total_committers":25,"mean_commits":6.8,"dds":"0.21764705882352942","last_synced_commit":"5a367d5ebd5fef2062b310d7c4602fdc4785edde"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavejester%2Feftest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavejester%2Feftest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavejester%2Feftest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weavejester%2Feftest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weavejester","download_url":"https://codeload.github.com/weavejester/eftest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247685617,"owners_count":20979085,"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","test-runner","testing"],"created_at":"2024-12-13T09:08:00.859Z","updated_at":"2025-04-07T16:01:29.130Z","avatar_url":"https://github.com/weavejester.png","language":"Clojure","readme":"# Eftest\n\n[![Build Status](https://travis-ci.org/weavejester/eftest.svg?branch=master)](https://travis-ci.org/weavejester/eftest)\n\nEftest is a fast and pretty Clojure test runner.\n\n## Installation\n\nTo install, add the following to your project `:dependencies`:\n\n    [eftest \"0.6.0\"]\n\nAlternatively, if you just want to use Eftest as a `lein test`\nreplacement, add the following to your project `:plugins`:\n\n    [lein-eftest \"0.6.0\"]\n\n## Screenshots\n\nWhen all the tests pass, it looks like this:\n\n![Passing example](doc/passing-example.png)\n\nWhen a test fails, it looks like:\n\n![Failing example](doc/failing-example.png)\n\nAnd when a test throws an exception, it looks like:\n\n![Erroring example](doc/erroring-example.png)\n\n## Usage\n\n### Library\n\nEftest has two main functions: `find-tests` and `run-tests`.\n\nThe `find-tests` function searches a source, which can be a namespace,\ndirectory path, symbol, var, or a collection of any of the previous.\nIt returns a collection of test vars found in the source.\n\nThe `run-tests` function accepts a collection of test vars and runs\nthem, delivering a report on the tests as it goes.\n\nTypically these two functions are used together:\n\n```clojure\nuser=\u003e (require '[eftest.runner :refer [find-tests run-tests]])\nnil\nuser=\u003e (run-tests (find-tests \"test\"))\n...\n```\n\nThe above example will run all tests found in the \"test\" directory.\n\n#### Multithreading\n\nBy default Eftest runs all tests in parallel, which can cause issues\nwith tests that expect to be single-threaded. To disable this and set\nall tests to be executed in serial, set the `:multithread?` option to\n`false`:\n\n```clojure\nuser=\u003e (run-tests (find-tests \"test\") {:multithread? false})\n```\n\nIf you want the test vars inside a namespace to be executed in\nparallel, but the namespaces themselves to be executed in serial, then\nset the `:multithread?` option to `:vars`:\n\n```clojure\nuser=\u003e (run-tests (find-tests \"test\") {:multithread? :vars})\n```\n\nIf you want the vars inside a namespace to execute in serial, but the\nnamespaces to be executed in parallel, set the `:multithread?` option\nto `:namespaces`:\n\n```clojure\nuser=\u003e (run-tests (find-tests \"test\") {:multithread? :namespaces})\n```\n\nAlternatively, you can add the `:eftest/synchronized` key as metadata\nto any tests you want to force to be executed in serial:\n\n```clojure\n(deftest ^:eftest/synchronized a-test\n  (is (= 1 1)))\n```\n\nOr you can synchronize the entire namespace:\n\n```clojure\n(ns ^:eftest/synchronized foo.core-test\n  (:require [clojure.test :refer :all]\n            [foo.core :refer :all]))\n```\n\n##### Setting the number of threads used\n\nWhen multithreading is enabled, Eftest uses a single fixed-threadpool\n[`ExecutorService`][executorservice] to run all selected tests.\n\nBy default, Eftest will instantiate the threadpool with the number of processors\n(cores) available to the JVM, as reported by\n[`Runtime.availableProcessors`][availableprocessors]. (NB: in some\ncircumstances, such as [in a CircleCI test container][resource-class],\n`Runtime.availableProcessors` returns an erroneous value.)\n\n[executorservice]: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/ExecutorService.html\n[availableprocessors]: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Runtime.html#availableProcessors()\n[resource-class]: https://circleci.com/docs/2.0/configuration-reference/#resource_class\n\nUsers can override the default behavior by including the key `:thread-count`\nin the options map supplied to `run-tests` with the value being any\npositive integer:\n\n```clojure\nuser=\u003e (run-tests (find-tests \"test\") {:thread-count 4})\n```\n\n#### Reporting\n\nYou can also change the reporting function used. For example, if you\nwant a colorized reporter but without the progress bar:\n\n```clojure\nuser=\u003e (run-tests (find-tests \"test\") {:report eftest.report.pretty/report})\n```\n\nOr JUnit output:\n\n```clojure\nuser=\u003e (run-tests (find-tests \"test\") {:report eftest.report.junit/report})\n```\n\nOr maybe you just want the old Clojure test reporter:\n\n```clojure\nuser=\u003e (run-tests (find-tests \"test\") {:report clojure.test/report})\n```\n\nIf you want to redirect reporting output to a file, use the\n`eftest.report/report-to-file` function:\n\n```clojure\nuser=\u003e (require '[eftest.report :refer [report-to-file]])\nnil\nuser=\u003e (require '[eftest.report.junit :as ju])\nnil\nuser=\u003e (run-tests (find-tests \"test\") {:report (report-to-file ju/report \"test.xml\")})\n```\n\n#### Output capturing\n\nBy default the STDOUT and STDERR from each test is captured, and\ndisplayed only if the test fails. This includes all the output\ngenerated by the test itself, and any output generated by other\nthreads not currently running a test.\n\nTo turn off this behavior, set the `:capture-output?` option to\n`false`:\n\n```clojure\nuser=\u003e (run-tests (find-tests \"test\") {:capture-output? false})\n```\n\n#### Fast failure\n\nSometimes it's useful to end the testing on the first test failure. To\ndo this set the `:fail-fast?` option to `true`:\n\n```clojure\nuser=\u003e (run-tests (find-tests \"test\") {:fail-fast? true})\n```\n\n#### Long test reporting\n\nIf you wish to monitor the length of time to run each test, you can\nset the `:test-warn-time` option to the threshold in milliseconds you\nwish to warn on long test for. The measured duration includes the\nrunning of `:each-fixtures`, but not `:once-fixtures`.\n\nIf you know a particular test to be slow and are ok with that, and\ndon't want to continually be warned about it, you can add the metadata\n`:eftest/slow` to either the individual test, or the entire namespace,\nto prevent reporting.\n\nNote that currently only the `pretty` and `progress` reporters support\nlogging long tests.\n\n```clojure\n;; Warns for all tests that take longer than 500ms\nuser=\u003e (run-tests (find-tests \"test\") {:test-warn-time 500})\n```\n\n### Plugin\n\nTo use the Lein-Eftest plugin, just run:\n\n```sh\nlein eftest\n```\n\nYou can customize the reporter and configure the concurrency settings\nby adding an `:eftest` key to your project map:\n\n```clojure\n:eftest {:multithread? :vars\n         :thread-count 4\n         :report eftest.report.junit/report\n         ;; You can optionally write the output to a file like so:\n         :report-to-file \"target/junit.xml\"}\n```\n\nLeiningen test selectors also work. With namespaces:\n\n```sh\nlein eftest foo.bar-test foo.baz-test\n```\n\nAnd with metadata keywords:\n\n```sh\nlein eftest :integration\n```\n\n## License\n\nCopyright © 2019 James Reeves\n\nDistributed under the Eclipse Public License either version 1.0 or (at\nyour option) any later version.\n","funding_links":[],"categories":["Libraries"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweavejester%2Feftest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweavejester%2Feftest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweavejester%2Feftest/lists"}