stroiman / respect

RSpec inspired test framework for Reason/OCaml/Bucklescript.
28 stars 2 forks source link
bdd bucklescript nodejs reason reasonml tdd unit-testing

ReSpect

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

Build Status

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.

Features

Getting Started

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

TODO

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.