stroiman / respect

RSpec inspired test framework for Reason/OCaml/Bucklescript.
28 stars 2 forks source link

OCaml (native) support? #4

Open ELLIOTTCABLE opened 6 years ago

ELLIOTTCABLE commented 6 years ago

Are there plans for native OCaml via jbuild, esy, or something of the like? Part of the point of Reason for me is writing code that targets both environments — Reason projects and native projects alike. I'd love a (non-OUnit) test-framework that could well support that …

(This is particularly appealing to me, as I “grew up” in Ruby, back in the day, when RSpec was new. I love the BDD approach to this day.)

stroiman commented 6 years ago

I don't have any plans for native support. I'm only using this from a bucklescript environment myself, and I have only published as NPM repo. I'm only using this on a private project, so I don't have the resources, nor a need, to support multiple builds. But I'll gladly accept contributions.

But I did write most of the core with portability in mind (although it does use Js.log for writing output - I really should change that anyway)

So, if I remember correctly, that really only leaves the cli entrypoint as the only hard JS dependency. It uses JS code to scan the file system, and JS require to load the files containing specs, and then calls the run function, which is Reason code.

In native ocaml, I think you could probably just compile all test cases into one executable, and from that executable, call the run function.

I wrote an F# tool, FSpec, also, and that was also the suggested way of running the tests: http://stroiman.com/software/fspec/getting-started-with-fspec/