{"library":"rescript-test","title":"ReScript Test Framework","description":"rescript-test is a lightweight and performant test framework designed specifically for ReScript projects. Currently at version 8.0.0, it provides a native ReScript API for writing unit and integration tests, leveraging ReScript's type system for robust assertions. It integrates directly into the ReScript build pipeline, running compiled `.bs.js` files. The framework offers core testing primitives like `test`, `testAsync`, and flexible `assertion` functions, alongside utilities for setup/teardown and optional DOM simulation via JSDOM. It aims to provide a straightforward, type-safe testing experience tailored for the ReScript ecosystem, differentiating itself from general JavaScript test runners by its deep integration with ReScript's language features. It appears to be actively maintained, with updates typically correlating with ReScript compiler releases.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install rescript-test"],"cli":null},"imports":["npx retest 'test/**/*.bs.js'","open Test"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"yarn add --dev rescript-test\n\n# Add to bsconfig.json:\n# {\n#   \"bs-dev-dependencies\": [\n#     \"rescript-test\"\n#   ]\n# }\n\n# Create test/MyTest.res\n// test/MyTest.res\nopen Test\n\nlet intEqual = (~message=?, a: int, b: int) =>\n  assertion(~message?, ~operator=\"intEqual\", (a, b) => a === b, a, b)\n\ntest(\"Basic integer equality\", () => {\n  let actual = 1 + 1\n  let expected = 2\n  intEqual(~message=\"1 + 1 should be 2\", actual, expected)\n})\n\ntest(\"Async operation test\", () => {\n  // In a real scenario, this would involve a Promise or callback\n  // For simplicity, showing a synchronous pass.\n  pass()\n})\n\n# Run the tests\nnpx retest 'test/**/*.bs.js'","lang":"typescript","description":"Demonstrates how to install `rescript-test`, configure `bsconfig.json`, write a basic ReScript test file with custom assertions, and execute it using the `retest` CLI.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}