{"id":21039018,"url":"https://github.com/nfisher/lein-nashtest","last_synced_at":"2025-05-15T16:32:11.402Z","repository":{"id":62433338,"uuid":"109794994","full_name":"nfisher/lein-nashtest","owner":"nfisher","description":"Run CLJS tests in nashorn using cljs.test report hooks.","archived":false,"fork":false,"pushed_at":"2017-12-04T16:14:25.000Z","size":28,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-14T22:44:44.511Z","etag":null,"topics":["clojurescript","lein-plugin","leiningen","testing"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nfisher.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-07T06:19:03.000Z","updated_at":"2023-09-26T19:39:54.000Z","dependencies_parsed_at":"2022-11-01T21:16:02.016Z","dependency_job_id":null,"html_url":"https://github.com/nfisher/lein-nashtest","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/nfisher%2Flein-nashtest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfisher%2Flein-nashtest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfisher%2Flein-nashtest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfisher%2Flein-nashtest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nfisher","download_url":"https://codeload.github.com/nfisher/lein-nashtest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254377221,"owners_count":22061100,"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","lein-plugin","leiningen","testing"],"created_at":"2024-11-19T13:37:18.226Z","updated_at":"2025-05-15T16:32:11.138Z","avatar_url":"https://github.com/nfisher.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lein-nashtest [![Clojars Project](https://img.shields.io/clojars/v/lein-nashtest.svg)](https://clojars.org/lein-nashtest)\n\nRun CLJS tests in nashorn using cljs.test report hooks.\n\n## Motivation\nnashtest has two primary goals;\n\n1. eliminate external dependencies (e.g. node, phantomjs, etc).\n2. \"clean\" instrumentation of cljs.test/no third-party macros (e.g. deftest, defrunner, etc).\n\n## Limitations\n\n* ECMAScript support is limited to Nashorns capabilities.\n  * DOM support is not available (e.g. document.* is absent).\n  * XMLHTTPRequest is not available.\n  * Timers are not available.\n  * Optimal target is ECMAScript 5.1.\n\nHappy to accept PR's if people want to provide shims.\n\n## Requirements\n\n* Java 8.\n* Leiningen 2.7.1+.\n* lein-cljsbuild 1.1.7+. (whitespace optimised target)\n\n## Basic Usage\n\n#### Single Execution\n\nSingle execution is intended for use in CI or as a precommit verification. If there are test failures the exit code will be 1, if all is green it will be 0.\n\n```\n$ lein nashtest\n\nTesting jbx.events-test\n\nRan 1 tests containing 12 assertions.\n0 failures, 0 errors.\n```\n\n#### Watch Loop Execution\n\nWatch loop execution is intended for continuous feedback during development. A change to the :load-js file will result in automatic execution of the whole test suite.\n\n```\n$ lein nashtest watch\nWatching for changes to test.js\n\nTesting jbx.events-test\n\nRan 1 tests containing 12 assertions.\n0 failures, 0 errors.\n```\n\n## Installation\n\n1) Add the plugin to your leiningen `project.clj` file.\n\n```clj\n  :plugins [[lein-nashtest \"0.1.3\"]]\n```\n\n2) Configure your cljsbuild test target in `project.clj`.\n\n```clj\n   :cljsbuild [{:id \"test\"\n                :source-paths [\"src/cljs\" \"src/cljc\" \"test/cljs\"]\n                :figwheel true\n                :compiler {:language-in :ecmascript5-strict\n                           :language-out :ecmascript5-strict\n                           :optimizations :whitespace\n                           :main jbx.runner\n                           :asset-path \"js/test\"\n                           :output-to  \"target/cljsbuild/public/js/test.js\"\n                           :cache-analysis true}]\n```\n**Note**: Whitespace optimisation is required because document.write().\n\n3) Create a cljs.test runner.\n\n```clj\n(ns jbx.runner\n  (:require\n    [cljs.test :as t :include-macros true]\n    [jbx.events-test]))\n\n(defn ^:export run\n  []\n  (enable-console-print!)\n  (t/run-all-tests #\"jbx.*-test\"))\n```\n\n**Note**: nashtest uses :test-main or :runner and will call your exported function as part of the test cycle. Do not include a call to the function at the bottom of your runner file.\n\n4) Configure nashtest with a root key in `project.clj`.\n\n```clj\n  :nashtest {:load-js \"test.js\"\n             :test-main \"jbx.runner/run\"}\n```\n\n## Planned Work\n\n1. ~~Introduce `:test-main` which would use Clojure style references (e.g. `jbx.runner/run`).~~ [#1](https://github.com/nfisher/lein-nashtest/issues/1)\n1. ~~File watcher.~~ [#2](https://github.com/nfisher/lein-nashtest/issues/2)\n1. ~~Inject cljs.test/report defmethod from runner.~~ [#3](https://github.com/nfisher/lein-nashtest/issues/3)\n1. Allow for multiple nashtest ids/targets.\n1. JUnit XML output.\n1. Naive document.write and \u003cscript\u003e to allow an unoptimised CLJS build.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfisher%2Flein-nashtest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnfisher%2Flein-nashtest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfisher%2Flein-nashtest/lists"}