/template-test-js-with-clj

A template for testing javascript code with clojurescript: test.check, unit tests, figwheel

Primary LanguageClojure

Rationale

Clojurescript provides powerful tools and semantics for testing code like deftest and test.check (generative testing). This repository is a template for testing javascript code with clojurescript code.

Structure

There is a javascript file main.js that defines a javascript function foo.

There is a clojurescript file core_test.cljs that tests foo.

core_test.cljs

In project.clj, main.js is defined as a :foreign-libs, so we can :require it from clojurescript.

The tests are run with lein doo.

Simple, no?

How to run

lein doo phantom test

Modify the code of the test inside src/js_test_in_cljs/test/core_test.cljs and the tests re-run automatically in under 1 second.