BDD-style test framework for Reason/bucklescript
Attention - _The NPM package has moved to @stroiman/respect
. Remember to
update both package.json AND bsconfig.json
._
The source repo was moved from to https://github.com/stroiman/respect.git
This is an RSpec inspired test framework for ReasonML/OCaml/Bucklescript. The runner uses raw javascript code, so it will only run in node environments at the moment.
I base this on a lot of experience I gained from a similar project for F#, FSpec.
This project is still in a very early stage, so use at your own risk. Breaking changes occur from time to time.
Run npm install --save-dev @stroiman/respect
and add @stroiman/respect
to the bs-dev-dependencies
in bsconfig.json
.
open Respect.Dsl.Sync;
describe "My first test" [
it "should be a failing test" (fun _ => {
1 |> should (equal (2))
})
] |> register
Add a test script to package.json
:
"scripts": {
...
"test": "respect"
}
Build the code and run the tests with: npm run test
For more info, including tips on test watcher functionality, see the full Documentation
TestContext
. This worked well
in F#/FSpec, but we don't have runtime type checking in Reason/Bucklescript.Although, I had learned from many mistakes when building FSpec, there are some problems that demand different solutions in Reason/Bucklescript. Async support in particular.