Testing
How to test your Derw code
Derw comes with a built-in test runner via derw test
. The runner is based on bach, a test runner written in TypeScript.
Writing a test
Naming your file
Your file must have the extension _test.derw
to be picked up by the test runner.
Importing the testing functions
Testing functions are provided by the stdlib, which you can install via:
These can then be imported like
Writing your test
A test function should be called testNameOfTest
, and have the type a -> void
. Test functions are automatically exported by the compiler.
In-browser tests
When working with html, you may find yourself needing to test a repeated set of actions in the browser - and ensuring the correct data shows up. This can be done via html-test package. It provides both a html element you can embed for results, and a console output. It is currently a work in progress, but if you're curious you can try it out.
Last updated