{"id":15654056,"url":"https://github.com/oliyh/fixa","last_synced_at":"2025-09-06T05:48:16.248Z","repository":{"id":57748617,"uuid":"365187100","full_name":"oliyh/fixa","owner":"oliyh","description":"Better test fixtures for clojure","archived":false,"fork":false,"pushed_at":"2022-08-11T16:33:22.000Z","size":18,"stargazers_count":27,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-18T12:02:28.523Z","etag":null,"topics":["clojure","fixtures","testing"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oliyh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["oliyh"]}},"created_at":"2021-05-07T09:46:46.000Z","updated_at":"2023-10-18T09:16:34.000Z","dependencies_parsed_at":"2022-08-27T00:11:17.841Z","dependency_job_id":null,"html_url":"https://github.com/oliyh/fixa","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/oliyh/fixa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliyh%2Ffixa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliyh%2Ffixa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliyh%2Ffixa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliyh%2Ffixa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oliyh","download_url":"https://codeload.github.com/oliyh/fixa/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliyh%2Ffixa/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273862483,"owners_count":25181545,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","fixtures","testing"],"created_at":"2024-10-03T12:49:20.951Z","updated_at":"2025-09-06T05:48:16.198Z","avatar_url":"https://github.com/oliyh.png","language":"Clojure","funding_links":["https://github.com/sponsors/oliyh"],"categories":[],"sub_categories":[],"readme":"# fixa\n\nBetter fixtures for Clojure\n\nWhy does `clojure.test` limit us to a single set of `:each` and `:once` fixtures for all tests in a namespace?\n\nShouldn't we have the granularity of being able to apply particular fixtures to an individual test?\n\nfixa lets you define fixtures at the individual test level using a simple metadata notation.\n\n[![Clojars Project](https://img.shields.io/clojars/v/com.github.oliyh/fixa.svg)](https://clojars.org/com.github.oliyh/fixa)\n\n## Usage\n\nFirstly you need to add the fixa metadata to your test vars, then choose the appropriate instructions for your test runner (kaocha or clojure.test).\n\nNote that the fixa fixtures will run _after_ any fixtures defined by `use-fixtures`.\n\n### Annotate your tests\n\nAdd `:fixa/fixture` (singular) or `:fixa/fixtures` (a list) as metadata to your `deftest`:\n\n```clj\n(deftest ^{:fixa/fixture fixture-a} single-fixture-test\n  (is (= 1 1)))\n\n(deftest ^{:fixa/fixtures [fixture-a fixture-b]} multiple-fixtures-test\n  (is (= 1 1)))\n```\n\n### Kaocha\n\nAll that's needed is the `fixa.kaocha/wrap-run` plugin. Add it to your `tests.edn` like this:\n\n```clj\n#kaocha/v1 {:plugins [:hooks]\n            :kaocha.hooks/wrap-run [fixa.kaocha/wrap-run]}\n```\n\n### clojure.test\n\nUnfortunately due to the way clojure.test is written, an alternative `deftest` is required to smuggle the fixtures through.\n\n```clj\n(require '[fixa.clj-test :refer [deftest]])\n\n(deftest ^{:fixa/fixture fixture-a} single-fixture-test\n  (is (= 1 1)))\n```\n\n## Built-in fixtures\n\nNow that fixa has added the ability to have per-test fixtures, we can do more.\nThe following are built-in fixtures provided by the library.\n\n### fail-after\n\nYou can add a `:fixa/fail-after` to your tests which will make the test start to fail when the date is surpassed:\n\n```clj\n(deftest ^{:fixa/fail-after \"2023-01-05\"} christmas-decorations-test\n  (is (christmas-decorations)))\n```\n\n### run-after\n\nYou can add a `:fixa/run-after` to your tests which will make the test skip evaluation until the date is surpassed:\n\n```clj\n(deftest ^{:fixa/run-after \"2022-12-01\"} future-v2-integration-test\n  (is (some-feature-only-available-in-v2)))\n```\n\n## Development\n\n[![CircleCI](https://circleci.com/gh/oliyh/fixa/tree/main.svg?style=svg)](https://circleci.com/gh/oliyh/fixa/tree/main)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foliyh%2Ffixa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foliyh%2Ffixa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foliyh%2Ffixa/lists"}