A testing library for janet
Add the dependency https://github.com/joy-framework/tester to your project.janet file:
(declare-project
:dependencies ["https://github.com/joy-framework/tester"])Create a .janet file for testing and use this library like so:
(import tester :prefix "" :exit true)
(deftest
(test "1 + 1 = 2"
(is (= 2 (+ 1 1))))
(test "expected = actual"
(let [expected "expected"
actual "expected"]
(is (= expected actual)))))Run your tests from the terminal with jpm test in your project directory
jpm testFor a better workflow, use entr to restart jpm test automatically on a file change like this:
; # ... rest of project.janet above
(phony "watch" []
(os/shell "find . -name '*.janet' | entr -r -d jpm test"))Then run this from the terminal and you're all set to get a fast running test suite on any file change in src or in test
jpm run watchAny issues or pull requests are welcome!
MIT