Skip to main content

Reason Testing Library

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.

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

Setup

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

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

or

{
"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:

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.

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

Then update bsconfig.json:

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