npm: possibly marvellous

    @dzakh/rescript-ava

    0.1.1 • Public • Published

    rescript-ava

    ReScript bindings for Ava

    Status

    • rescript-ava uses Ava 4.3.0
    • rescript-ava has bindings for ~95% original functionality. If you find some bindings you need are missing, contributions are welcome

    Usage

    Installation

    npm install --save-dev @dzakh/rescript-ava

    Then add @dzakh/rescript-ava to bs-dev-dependencies in your bsconfig.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": "1.0.0"
      },
    + "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
    
    Ava.test("foo", t => {
      t->Ava.Assert.pass()
    })
    
    Ava.asyncTest("bar", t => {
      Promise.resolve("bar")->Promise.thenResolve(bar => {
        t->Ava.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:

    Install

    npm i @dzakh/rescript-ava

    DownloadsWeekly Downloads

    7

    Version

    0.1.1

    License

    MIT

    Unpacked Size

    15.3 kB

    Total Files

    6

    Last publish

    Collaborators

    • dzakh