Back to Testing Library

Reason Testing Library

docs/bs-react-testing-library/intro.mdx

latest1.5 KB
Original Source

Bindings for several testing libraries have been ported to ReasonML.

bs-react-testing-library contains BuckleScript bindings for React Testing Library.

bs-dom-testing-library contains BuckleScript bindings for DOM Testing Library.

bash
npm install --save-dev bs-dom-testing-library
bash
npm install --save-dev bs-react-testing-library

Setup

After installation, you will need the packages bsconfig.json file like so:

json
{
  "bs-dev-dependencies": ["bs-react-testing-library"]
}

or

json
{
  "bs-dev-dependencies": ["bs-dom-testing-library"]
}

Other Dependencies

bs-platform

This is what BuckleScript uses to compile the Reason code to JS. If it is not in your project you can install it like so:

bash
npm install --save-dev bs-platform

bs-jest

This is the recommended test runner and is a wrapper around Jest. All of the examples here will be using it.

bash
npm install --save-dev @glennsl/bs-jest

Then update bsconfig.json:

json
{
  "bs-dev-dependencies": ["@glennsl/bs-jest"]
}