3.0.0 • Published 9 days ago

@dzakh/rescript-ava v3.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 days ago

rescript-ava

Runtime free ReScript bindings for Ava

Usage

Installation

npm install -D @dzakh/rescript-ava ava@5.2.x

Then add @dzakh/rescript-ava to bs-dev-dependencies in your rescript.json:

{
  ...
+ "bs-dev-dependencies": ["@dzakh/rescript-ava"]
}

Then add __tests__ to sources in your bsconfig.json:

"sources": [
  {
    "dir": "src"
  },
+ {
+   "dir": "__tests__",
+   "type": "dev"
+ }
]

Then add test script and minimalistic configuration in your package.json:

{
  "name": "awesome-package",
  "scripts": {
+   "test": "ava"
  },
  "devDependencies": {
    "@dzakh/rescript-ava": "latest"
  },
+ "ava": {
+   "files": [
+     "__tests__/**/*_test.mjs",
+     "__tests__/**/*_test.bs.js"
+   ]
+ }
}

Create your test file

Create a test file in the tests directory and use the suffix *_test.res. When compiled they will be put in a tests directory with a *_test.bs.js suffix, ready to be picked up when you run ava. If you're not already familiar with Ava, see the Ava documentation.

// __tests__/Main_test.res
open Ava

test("foo", t => {
  t->Assert.pass()
})

asyncTest("bar", t => {
  Promise.resolve("bar")->Promise.thenResolve(bar => {
    t->Assert.is(bar, "bar", ())
  })
})

Running your tests

npm test

Or with npx:

npx ava

Run with the --watch flag to enable AVA's watch mode:

npx ava --watch

Documentation

For the moment, please refer to Ava.res.

Examples

Open source projects using rescript-ava:

3.0.0

9 days ago

2.3.0

1 year ago

1.0.0

2 years ago

2.1.0

1 year ago

2.0.0

1 year ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago