Skip to content

Commit

Permalink
Add a readme and license
Browse files Browse the repository at this point in the history
  • Loading branch information
Olical committed Mar 7, 2018
1 parent 3e55cce commit 0e93a01
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# cljs-test-runner [![Clojars Project](https://img.shields.io/clojars/v/olical/cljs-test-runner.svg)](https://clojars.org/olical/cljs-test-runner)

Run all of your [ClojureScript][] tests with one simple command.

Inspired by Cognitect's [test-runner][] for [Clojure][], it is designed to be used in conjunction with Clojure 1.9's CLI tool and a `deps.edn` file.

Under the hood, it's building a test runner file for you, compiling everything into the `cljs-test-runner-out` directory and then executing the compiled tests with [doo][]. Discovery of namespaces is automatic, it assumes your tests are located in the `test` directory.

## Usage

You're going to want to add the dependency and a call to the `cljs-test-runner.main` namespace to your `deps.edn` file. I recommend you put this under the `test` alias, like so.

```clojure
{:deps {org.clojure/clojure {:mvn/version "1.9.0"}
org.clojure/clojurescript {:mvn/version "1.10.126"}}
:aliases {:test {:extra-paths ["test"]
:extra-deps {olical/cljs-test-runner {:mvn/version "1.0.0"}}
:main-opts ["-m" "cljs-test-runner.main"]}}}
```

This will (by default) find, compile and execute your tests through [node][]. You can tell it to execute your tests in [phantom][] if you need to, but I'd recommend node and something like [jsdom][] if possible.

```
# Execute all of your tests in node.
clojure -Atest
Testing example.partial-test
Testing example.yes-test
Ran 2 tests containing 2 assertions.
0 failures, 0 errors.
# Execute all of your tests in phantom.
clojure -Atest --env phantom
```

The `--env` flag simply defaults to `node`, you can specify it within your `main-opts` of your alias if you want to.

## Unlicenced

Find the full [unlicense][] in the `UNLICENSE` file, but here's a snippet.

>This is free and unencumbered software released into the public domain.
>
>Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
Do what you want. Learn as much as you can. Unlicense more software.

[clojure]: https://clojure.org/
[clojurescript]: https://clojurescript.org/
[test-runner]: https://github.com/cognitect-labs/test-runner
[doo]: https://github.com/bensu/doo
[node]: https://nodejs.org
[phantom]: http://phantomjs.org/
[jsdom]: https://github.com/jsdom/jsdom
[unlicense]: http://unlicense.org/
24 changes: 24 additions & 0 deletions UNLICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org/>

0 comments on commit 0e93a01

Please sign in to comment.