{"id":18456973,"url":"https://github.com/bhauman/cljs-test-display","last_synced_at":"2025-04-05T13:09:34.467Z","repository":{"id":62431730,"uuid":"138505920","full_name":"bhauman/cljs-test-display","owner":"bhauman","description":"Visual display for ClojureScript tests.","archived":false,"fork":false,"pushed_at":"2022-07-15T15:44:06.000Z","size":26,"stargazers_count":108,"open_issues_count":6,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-05-08T19:13:31.327Z","etag":null,"topics":["clojure","clojurescript","testing","testing-tools"],"latest_commit_sha":null,"homepage":null,"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/bhauman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["bhauman"]}},"created_at":"2018-06-24T18:29:21.000Z","updated_at":"2023-11-06T13:16:26.000Z","dependencies_parsed_at":"2022-11-01T21:00:41.797Z","dependency_job_id":null,"html_url":"https://github.com/bhauman/cljs-test-display","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhauman%2Fcljs-test-display","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhauman%2Fcljs-test-display/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhauman%2Fcljs-test-display/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhauman%2Fcljs-test-display/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bhauman","download_url":"https://codeload.github.com/bhauman/cljs-test-display/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339158,"owners_count":20923014,"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","clojurescript","testing","testing-tools"],"created_at":"2024-11-06T08:13:10.749Z","updated_at":"2025-04-05T13:09:34.443Z","avatar_url":"https://github.com/bhauman.png","language":"Clojure","funding_links":["https://github.com/sponsors/bhauman"],"categories":[],"sub_categories":[],"readme":"# cljs-test-display\n\n[![Clojars Project](https://img.shields.io/clojars/v/com.bhauman/cljs-test-display.svg)](https://clojars.org/com.bhauman/cljs-test-display)\n\n`cljs-test-display` is a library that produces a visual display of an\nin-browser ClojureScript test run.\n\n\u003cimg src=\"https://s3.amazonaws.com/bhauman-blog-images/cljs-test-display-screenshot.png\" width=\"500\"/\u003e\n\n## Overview\n\n`cljs-test-display` is a ClojureScript library that you can use\nalong with your web-based test runner to provide visual and system\nfeedback for your test runs.\n\nIf you have tests written with `cljs.test` and you can run them in the\nbrowser you can use `cljs-test-display`.\n\n## Features\n\n* Fully compatible with `cljs.test`\n* Small understandable codebase\n* Only a ClojureScript library, no server-side component\n* No dependencies\n\n* Red/green favicon feedback\n\n\u003cimg src=\"https://s3.amazonaws.com/bhauman-blog-images/cljs-test-display-tab.png\" width=\"500\"/\u003e\n\n* Numbered stacktraces for test exceptions in the dev console\n\n\u003cimg src=\"https://s3.amazonaws.com/bhauman-blog-images/cljs-test-display-error-stacktrace.png\" width=\"500\"/\u003e\n\n* Hide/show passing tests with a key-press\n\n\u003cimg src=\"https://s3.amazonaws.com/bhauman-blog-images/cljs-test-display-toggle-visible.png\" width=\"500\"/\u003e\n\n* System notifications for passing and failing test runs\n\n\u003cimg src=\"https://s3.amazonaws.com/bhauman-blog-images/cljs-test-display-system-notifications.png\" width=\"300\"/\u003e\n\n* Straightforward integration\n\n```clojure\n;; where \"app\" is the HTML node where you want to mount the tests\n(cljs.test/run-tests \n  (cljs-test-display.core/init! \"app\") ;;\u003c-- initialize cljs-test-display here\n  'example.foo-test \n  'example.bar-test \n  'example.baz-test)\n```\n\n# Usage\n\n\u003e You will need to be familiar with how to create a ClojureScript\n\u003e application and run it in a browser.\n\n### Dependencies\n\nYou will need to add `[com.bhauman/cljs-test-display \"0.1.1\"]` to your\nproject's dependencies *along with* a recent version of\nClojureScript. It has been tested with\n`[org.clojure/cojurescript 1.10.238]` and above, but it should work\nwith almost any version of ClojureScript that includes `cljs.test`.\n\n### Test runner integration\n\nFirst, you will need to require `cljs-test-display.core` in your test\nrunner, then call the `cljs-test-display.core/init!` function.\n`init!` returns a `cljs.test` environment much like\n`cljs.test/empty-env` initialized so that `cljs-test-display` is\nengaged.\n\nExample: `test/example/test_runner.cljs`\n\n```clojure\n(ns example.test-runner\n  (:require \n    [cljs.test]\n    [cljs-test-display.core]\n    [example.foo-test]\n    [example.bar-test]\n    [example.baz-test])\n  (:require-macros\n    [cljs.test]))\n\t\n(defn test-run []\n  ;; where \"app\" is the HTML node where you want to mount the tests\n  (cljs.test/run-tests \n    (cljs-test-display.core/init! \"app\") ;;\u003c-- initialize cljs-test-display here\n    'example.foo-test \n    'example.bar-test \n    'example.baz-test))\n```\n\nProviding `init!` the element id is optional: `app` is the default.\n\nIt is important to note that the `cljs-test-display.core/init!`\nfunction is designed to be called repeatedly in the same environment,\nto facilitate hot reloading and test re-runs.\n\n\u003e For the best development experience, invoke your test\n\u003e runner after every hot reload.\n\n### HTML host file\n\nThe HTML that hosts the tests can be very simple.\n\nExample `resources/public/tests.html` file:\n\n```html\n\u003chtml\u003e\n  \u003c!-- the head element is required as this is where we add CSS and favicon elements --\u003e\n  \u003chead\u003e\u003c/head\u003e\n  \u003cbody\u003e\n    \u003cdiv id=\"app\"\u003e\u003c/div\u003e\n    \u003cscript src=\"[path to your compiled cljs]\" type=\"text/javascript\"\u003e\u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Configuration\n\nYou can configure `cljs-test-display` by adding keys to the\n`:closure-defines` key in your ClojureScript compiler options.\n\n```clojure\n{:main example.core\n :output-to \"main.js\"\n ...\n :closure-defines {\n    ;; set the element id of where the tests will mount\n    cljs-test-display.core/root-node-id \"test-app\" ;; default \"app\"\n\t\n    ;; disable the favicon changing behavior\n    cljs-test-display.core/change-favicon false    ;; default true\n\t\n    ;; disable the system notifications\n    cljs-test-display.core/notifications  false    ;; default true\n\t\n    ;; enable the printing of test results\n    cljs-test-display.core/printing       true     ;; default false\n }}\n```\n\n### Providing your own style \n\nYou can override the injected CSS by supplying your own CSS via an HTML tag\nwith an id `cljs-test-display-style`.\n\nFor Example:\n\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003c!-- override injected css --\u003e\n    \u003clink id=\"cljs-test-display-style\" type=\"text/css\" href=\"css/my-css.css\"\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n  \n    ;; you can also place CSS here if you only wish to ammend the CSS\n\t\n    \u003cdiv id=\"app\"\u003e\u003c/div\u003e\n    \u003cscript src=\"[path to your compiled cljs]\" type=\"text/javascript\"\u003e\u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n\n## Development\n\nYou should be able to work on `cljs-test-display` by forking/cloning\nthis repo and then `cd`ing into the `cljs-test-display` directory and\nrunning.\n\n    clojure -A:build\n\nThis will auto-compile and send all changes to the browser without the\nneed to reload. After the compilation process is complete, you will\nget a Browser Connected REPL. An easy way to try it is:\n\n    (js/alert \"Am I connected?\")\n\nThis should cause an alert to pop up in the browser window.\n\nYou will now be able to live edit the code in\n`src/cljs-test-display/core.cljs` and live edit the CSS in\n`resources/public/com/bhauman/cljs-test-display/css/style.css`.\n\nTo clean all compiled files:\n\n    rm -rf target/public\n\n## License\n\nCopyright © 2018 Bruce Hauman\n\nDistributed under the Eclipse Public License either version 1.0 or (at your option) any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbhauman%2Fcljs-test-display","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbhauman%2Fcljs-test-display","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbhauman%2Fcljs-test-display/lists"}