squint-cljs / cherry

Experimental ClojureScript to ES6 module compiler
https://squint-cljs.github.io/cherry
558 stars 22 forks source link

Tests #9

Closed borkdude closed 2 years ago

borkdude commented 2 years ago

Right now there are informal tests in "corpus". I think we could make each script return true or else throw an exception or so and then run these in CI as a way of testing.

borkdude commented 2 years ago

I actually found that this works pretty well as a testing function for small snippets, let's go with that to test things in the small:

(defn eval! [expr] (js/eval (doto (t/transpile-form expr) prn)))
borkdude commented 2 years ago

Currently running tests in the REPL like this:

clj -M:cljs -m cljs.main -re node
(require '[cherry.transpiler] :reload '[cherry.transpiler-test] :reload) (cljs.test/run-tests 'cherry.transpiler-test)

Running "corpus" tests like this:

ls corpus/*.cljs | xargs -L 1 node --experimental-fetch ./node_cli.js run