Installation
First, let's install ReScript Test using your favorite package manager.
Console
$ yarn add --dev rescript-testThen, let's adapt our ReScript compiler config file (bsconfig.json).
In sources:
bsconfig.json
"sources": [ { "dir": "src", "subdirs": true },+ { "dir": "tests", "subdirs": true, "type": "dev" } ]note
Notice the type: "dev", it makes the ReScript compiler only compile those files when your project is the one you're working on (meaning it won't compile those files when your project is installed as a dependency).
In bs-dev-dependencies:
bsconfig.json
"bs-dev-dependencies": [+ "rescript-test" ]Everything's configured now!
Now let's add a test command in our package.json:
package.json
"scripts": {+ "test": "retest tests/*.mjs" }