{"id":24294561,"url":"https://github.com/miikka/karma-demo","last_synced_at":"2025-09-25T20:31:31.341Z","repository":{"id":21867678,"uuid":"81117694","full_name":"miikka/karma-demo","owner":"miikka","description":"Use Karma to run ClojureScript tests in Chrome","archived":false,"fork":false,"pushed_at":"2023-01-27T01:42:47.000Z","size":229,"stargazers_count":9,"open_issues_count":10,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-13T23:55:14.949Z","etag":null,"topics":["clojurescript","karma","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miikka.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}},"created_at":"2017-02-06T18:24:48.000Z","updated_at":"2024-04-13T23:55:14.950Z","dependencies_parsed_at":"2023-02-17T23:15:19.051Z","dependency_job_id":null,"html_url":"https://github.com/miikka/karma-demo","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/miikka%2Fkarma-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miikka%2Fkarma-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miikka%2Fkarma-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miikka%2Fkarma-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miikka","download_url":"https://codeload.github.com/miikka/karma-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234244285,"owners_count":18801894,"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","karma","testing"],"created_at":"2025-01-16T17:47:34.475Z","updated_at":"2025-09-25T20:31:26.051Z","avatar_url":"https://github.com/miikka.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Running ClojureScript tests with Karma\n\nThis repository demonstrates how to use [Karma][karma] to run ClojureScript\ntests in Chrome with JUnit output and slow test reporting.\n\nFirst of all, if [doo][doo] fits your needs, by all means use it. Doo can run\nKarma just fine. The trouble is that\n[you can't really configure Karma with doo][doo-43]. Here are some reasons for\nwhy I've wanted to configure Karma:\n\n* I wanted to include a collection of JavaScript files to be executed - in the\n  correct order - before the tests.\n* I wanted to get JUnit output for the tests.\n\nLuckily it's straightforward to use Karma directly!\n\n\n## How to build and run the tests\n\nStart the Karma server:\n\n    npm install\n    ./node_modules/karma-cli/bin/karma start\n\nIn another terminal, start cljsbuild:\n\n    lein cljsbuild auto\n\nNow go and edit some of the `.cljs` files. The tests should be automatically\nrun. You can also manually start a test run with `./trigger-karma.sh`. The JUnit\nfiles are under `target/out/reports`.\n\n\n## How does this work?\n\nBasically we do what doo does, but manually. We use\n[lein-cljsbuild][lein-cljsbuild] and [karma-reporter][karma-reporter]. Here are\nthe important files:\n\n* [`package.json`](./package.json) lists the Karma components we need to install\n  from npm.\n* [`karma_demo/runner.cljs`](./test/cljs/karma_demo/runner.cljs) is our test\n  runner namespace. It requires all the test namespaces and calls\n  `jx.reporter.karma/run-all-tests`.\n* [`project.clj`](./project.clj) configures cljsbuild to compile the test runner.\n* [`karma.conf.js`](./karma.conf.js) is our Karma configuration. It points\n  Karma to the compiled JavaScript files, configures the JUnit output etc.\n  \nI've included some comments into the files to draw attention to the interesting\nparts.\n  \nWe do not use Karma's autowatch feature, because it tends to re-run the tests\nwhile cljsbuild is still compiling them. Instead we set cljsbuild's\n`:notify-command` to trigger the tests when the build is ready. I've tried to\nplay with `autoWatchBatchDelay` option, but it's hard to get right.\n\n[karma]: http://karma-runner.github.io/\n[doo]: https://github.com/bensu/doo\n[doo-43]: https://github.com/bensu/doo/issues/43\n[boot-cljs-test]: https://github.com/crisptrutski/boot-cljs-test\n[karma-reporter]: https://github.com/honzabrecka/karma-reporter\n[lein-cljsbuild]: https://github.com/emezeske/lein-cljsbuild\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiikka%2Fkarma-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiikka%2Fkarma-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiikka%2Fkarma-demo/lists"}