{"id":19238217,"url":"https://github.com/olical/cljs-test-runner","last_synced_at":"2025-04-06T02:10:41.818Z","repository":{"id":62432878,"uuid":"123614382","full_name":"Olical/cljs-test-runner","owner":"Olical","description":"Discover and run your ClojureScript tests","archived":false,"fork":false,"pushed_at":"2024-02-09T12:14:13.000Z","size":172,"stargazers_count":86,"open_issues_count":3,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T01:09:11.042Z","etag":null,"topics":["clojurescript","testing"],"latest_commit_sha":null,"homepage":"https://clojars.org/olical/cljs-test-runner","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Olical.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","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":"2018-03-02T18:17:12.000Z","updated_at":"2024-09-29T22:04:42.000Z","dependencies_parsed_at":"2024-11-09T16:31:49.708Z","dependency_job_id":"f49cb5d8-f91e-4a40-903c-fa3dcdb8dc65","html_url":"https://github.com/Olical/cljs-test-runner","commit_stats":{"total_commits":145,"total_committers":10,"mean_commits":14.5,"dds":0.1448275862068965,"last_synced_commit":"a9cc21916f32fb6caa9f54e349e7cc32b199b0c2"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Olical%2Fcljs-test-runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Olical%2Fcljs-test-runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Olical%2Fcljs-test-runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Olical%2Fcljs-test-runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Olical","download_url":"https://codeload.github.com/Olical/cljs-test-runner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423515,"owners_count":20936626,"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":["clojurescript","testing"],"created_at":"2024-11-09T16:29:50.561Z","updated_at":"2025-04-06T02:10:41.793Z","avatar_url":"https://github.com/Olical.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cljs-test-runner [![Clojars Project](https://img.shields.io/clojars/v/olical/cljs-test-runner.svg)](https://clojars.org/olical/cljs-test-runner)\n\nRun all of your [ClojureScript][ClojureScript] tests with one simple command.\n\nInspired by Cognitect's [test-runner][test-runner] for [Clojure][Clojure], it is\ndesigned to be used in conjunction with the Clojure CLI tool and a `deps.edn`\nfile.\n\nUnder the hood it's building a test runner file, compiling everything and then\nexecuting the compiled tests with [doo][doo] (using\n[ingesolvoll's fork][doo-fork]). Discovery of test namespaces is automatic, so\nno configuration is required.\n\n## Usage\n\nIn simple cases, you'll be able to execute your tests with something as succinct\nas the following line.\n\n```bash\n$ clojure -Sdeps '{:deps {olical/cljs-test-runner {:mvn/version \"3.8.1\"}}}' -m cljs-test-runner.main\n```\n\n\u003e Note: The generated test code is placed in the directory\n\u003e `cljs-test-runner-out` by default (configure with `--out`), you should add\n\u003e that to your `.gitignore` file.\n\nIt's likely that your tests will require dependencies and configuration that\nwould become unwieldy in this format. You will need to add the dependency and\n`--main` (`-m`) parameter to your `deps.edn` file.\n\nI recommend you put this under an alias such as `test` or `cljs-test` if that's\nalready taken by your Clojure tests.\n\n```clojure\n{:deps {org.clojure/clojure {:mvn/version \"1.10.1\"}\n        org.clojure/clojurescript {:mvn/version \"1.10.520\"}}\n :aliases {:test {:extra-deps {olical/cljs-test-runner {:mvn/version \"3.8.1\"}}\n                  :main-opts [\"-m\" \"cljs-test-runner.main\"]}}}\n```\n\nThe following will then find, compile and execute your tests through\n[node][node].\n\n```bash\n$ clojure -Atest\n\nTesting example.partial-test\n\nTesting example.yes-test\n\nRan 2 tests containing 2 assertions.\n0 failures, 0 errors.\n```\n\n## Configuration\n\nYou can configure the test runner with a few different flags, the most important\none is `--env` (`-x`) which allows you to swap from node to [phantom][phantom]\nor chrome-headless if required. I would recommend sticking to node and using\nsomething like [jsdom][jsdom], but this does come down to preference and\ntechnical requirements.\n\n```bash\n$ clojure -Atest -x phantom\n```\n\nIf you need to use `foreign-libs` or any cljs compiler flags that are not\nmirrored in cljs-test-runner's flags, you can put them into an EDN file and\npoint to that file using the `--compile-opts` flag.\n\nYou can use `--help` to see the current flags and their default values.\n\n```bash\n$ clojure -Atest --help\n  -d, --dir DIRNAME            test                  The directory containing your test files\n  -n, --namespace SYMBOL                             Symbol indicating a specific namespace to test.\n  -r, --namespace-regex REGEX  .*\\-test$             Regex for namespaces to test. Only namespaces ending in '-test' are evaluated by default.\n  -v, --var SYMBOL                                   Symbol indicating the fully qualified name of a specific test.\n  -i, --include SYMBOL                               Run only tests that have this metadata keyword.\n  -e, --exclude SYMBOL                               Exclude tests with this metadata keyword.\n  -o, --out DIRNAME            cljs-test-runner-out  The output directory for compiled test code\n  -x, --env ENV                node                  Run your tests in node, phantom, chrome-headless, lumo or planck.\n  -w, --watch DIRNAME                                Directory to watch for changes (alongside the test directory). May be repeated.\n  -c, --compile-opts PATH                            EDN file containing opts to be passed to the ClojureScript compiler.\n  -D, --doo-opts PATH                                EDN file containing opts to be passed to doo.\n  -V, --verbose                                      Flag passed directly to the ClojureScript compiler to enable verbose compiler output.\n  -H, --help\n```\n\n## Advanced compilation\n\nTo use Closure Compiler advanced optimisation levels you will need to create an\nEDN file like this:\n\n```edn\n{:optimizations :advanced}\n```\n\nNow when you run the following, your tests will be executed with advanced\ncompilation:\n\n```bash\nclj -m cljs-test-runner.main -c ./config/advanced-compilation.edn\n```\n\nYou can also directly inline the EDN using the `-c` flag:\n\n```bash\nclj -m cljs-test-runner.main -c '{:optimizations :advanced}'\n```\n\nThere is a known issue with `:whitespace`, I just haven't invested the time into\nworking out what it is. For now, stick to `:none`, `:simple` or `:advanced`, the\noriginal issue for optimisation levels breaking things is [#16][#16].\n\n## Bundle target\n\nThe new [bundle][bundle] target requires a 2-step process for compilation. One\nfor building an `index.js` consumable by bundlers like webpack, and a second\nstep for actually running the bundler. This requires you to specify 2 different\ntargets.\n\nIn essence, this requires you to include the following in your `doo.edn`:\n\n`{:output-to \"resources/public/js/main.js\"}`\n\nYour CLJS compiler options should be according to the standard guide.\n\n## Gotchas\n\n### Paths\n\nMake sure the directory (or directories!) containing your tests are on your Java\nclass path. Specify this with a top level `:paths` key in your `deps.edn` file.\n\n### Lumo / Planck\n\nTo use Lumo or Planck, add the generated test runner to the `:paths` in your\n`deps.edn`:\n\n```edn\n:paths [\"src\" \"test\" \"cljs-test-runner-out/gen\"]\n```\n\nand set the environment:\n\n    -x lumo\n\nor\n\n    -x planck\n\n## Unlicenced\n\nFind the full [unlicense][unlicense] in the `UNLICENSE` file, but here's a\nsnippet.\n\n\u003e This is free and unencumbered software released into the public domain.\n\u003e\n\u003e Anyone is free to copy, modify, publish, use, compile, sell, or distribute\n\u003e this software, either in source code form or as a compiled binary, for any\n\u003e purpose, commercial or non-commercial, and by any means.\n\nDo what you want. Learn as much as you can. Unlicense more software.\n\n[clojure]: https://clojure.org/\n[clojurescript]: https://clojurescript.org/\n[test-runner]: https://github.com/cognitect-labs/test-runner\n[doo]: https://github.com/bensu/doo\n[doo-fork]: https://github.com/ingesolvoll/doo\n[node]: https://nodejs.org\n[phantom]: http://phantomjs.org/\n[jsdom]: https://github.com/jsdom/jsdom\n[unlicense]: http://unlicense.org/\n[#16]: https://github.com/Olical/cljs-test-runner/issues/16\n[bundle]: https://clojurescript.org/guides/webpack\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folical%2Fcljs-test-runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folical%2Fcljs-test-runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folical%2Fcljs-test-runner/lists"}