Problems getting started with bs-jest - not bound errors for Expect methods


#1

Trying to write a simple jest test using not_ and toThrow to test that an expression or statement (originally a function call) call does NOT throw an error.

The original code under test is as follows, but simplified the example below to make it more clear.
I guess ideally I should not raise an error but use option with Some/None?

let handle = result =>
  switch (result) {
  | Some(v) => v
  | None => raise(Not_found)
  };

let write = () => LitHtml.html("<div></div>") |> handle;

Tells me that not_ and toThrow are not bound. Using lates bs-platform version 4.0.18
toEqual however is bound. What could be the issue?

open Jest;
open Expect;

describe("Write", () =>
  test("#html", () =>
    expect("<div/>") |> not_ |> toThrow
  )
);

describe("Calc", () =>
  test("#add", () =>
    expect(1 + 1) |> toEqual(1)
  )
);

#2

Can you post what build commands you ran? To get started usually you’ll have to run bsb -make-world to make sure the dependencies are compiled.


#3

Turns out it was a problem with multiple conflicting refmt versions due to reason-cli installed globally and OCaml and Reason IDE extension in VSCode. After uninstalling both it worked :slight_smile: