This project is currently under development.
Val Town should have a standard way to write tests. The idea behind this project is to create such a standard test framework for Val Town.
So far I have two prototypes:
- In secret_scanner
- In glide_omni
Both are fine. Both have the tests as JSON (name, input, output). There are two differences:
- The first test uses lodash's isEqual and the second uses
expect
from Deno's std library - The first outputs to an HTML page in an HTTP val, the second logs to the console
Probably expect
is the right tool for the job.
The main issues with them are:
- It would be nice to have better standard test syntax (ie
it
anddescribe
). Maybe such a library could work here or maybe I could build it in this project. - I'd love the ability to run the tests on every save. Or configurable on any action. Eventually, we'll want to run tests on pull requests, ie before merging. Maybe project-wide logs will help. Maybe configuring cmd+enter will help.
Also: would be neat if I could run tests in an interactive mode that would let me save the new "snapshots".
Jackson has an awesome prototype that includes a badge you can include in readmes, and it will rerun the tests whenever the badge is loaded: https://www.val.town/v/jxnblk/test