npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

zekr

v1.6.0

Published

A simple test framework for ReScript

Readme

zekr

npm version license

A simple test framework for ReScript.

Installation

npm install zekr

Add to your rescript.json:

{
  "dev-dependencies": ["zekr"]
}

Usage

open Zekr

let myTests = suite("My Tests", [
  test("addition works", () => {
    assertEqual(1 + 1, 2)
  }),
  test("strings match", () => {
    assertEqual("hello", "hello")
  }),
  test("condition is true", () => {
    assertTrue(10 > 5)
  }),
])

runSuites([myTests])

API

Creating Tests

// Create a single test
let myTest = test("test name", () => {
  // return Pass or Fail(message)
  Pass
})

// Create a test suite
let mySuite = suite("Suite Name", [test1, test2, test3])

Setup/Teardown Hooks

Add lifecycle hooks directly to your test suites:

// Synchronous hooks
let mySuite = suite(
  "Database Tests",
  [test1, test2, test3],
  ~beforeAll=() => initializeDatabase(),
  ~afterAll=() => closeDatabase(),
  ~beforeEach=() => clearTables(),
  ~afterEach=() => resetState(),
)

// Async hooks
let myAsyncSuite = asyncSuite(
  "API Tests",
  [asyncTest1, asyncTest2],
  ~beforeAll=async () => await connectToServer(),
  ~afterAll=async () => await disconnectFromServer(),
  ~beforeEach=async () => await resetMocks(),
  ~afterEach=async () => await cleanup(),
)

All hooks are optional - you only need to provide the ones you need:

// Only beforeEach hook
let mySuite = suite(
  "My Tests",
  [test1, test2],
  ~beforeEach=() => resetState(),
)

Async Tests with Timeout

Async tests support an optional timeout parameter (in milliseconds). Tests that exceed the timeout will fail automatically. Uncaught exceptions in async tests are also caught and reported as failures.

let myAsyncTests = asyncSuite("API Tests", [
  // Test with 5 second timeout
  asyncTest("fetches data", async () => {
    let data = await fetchData()
    assertEqual(data.status, "ok")
  }, ~timeout=5000),

  // Test without timeout (runs until completion)
  asyncTest("processes data", async () => {
    let result = await processData()
    assertTrue(result.success)
  }),
])

Assertions

// Check equality
assertEqual(actual, expected)
assertEqual(actual, expected, ~message="custom message")

// Check inequality
assertNotEqual(actual, expected)

// Check boolean conditions
assertTrue(condition)
assertFalse(condition)

// Combine multiple results
combineResults([result1, result2, result3])

Snapshot Testing

Test complex data structures by comparing against stored snapshots:

let snapshotTests = suite("API Response", [
  test("user data matches snapshot", () => {
    let user = {"id": 1, "name": "Alice", "roles": ["admin", "user"]}
    assertMatchesSnapshot(user, ~name="user-data")
  }),
])

On first run, snapshots are created in __snapshots__/ directory. Subsequent runs compare against stored snapshots.

// Configure custom snapshot directory
setSnapshotDir("tests/__snapshots__")

// Update a snapshot programmatically
updateSnapshot(newValue, ~name="snapshot-name")

Test Filtering

Filter tests using environment variables:

# Run only tests matching "user"
ZEKR_FILTER="user" node tests/MyTests.js

# Skip tests matching "slow"
ZEKR_SKIP="slow" node tests/MyTests.js

# Combine filter and skip
ZEKR_FILTER="api" ZEKR_SKIP="integration" node tests/MyTests.js

Filtering is case-insensitive and matches against both suite and test names.

Watch Mode

Automatically re-run tests when files change:

// In a separate watch script (e.g., watch.res)
open Zekr

watchMode(
  ~testCommand="node tests/MyTests.js",
  ~watchPaths=["src", "tests"],
  ~buildCommand="npx rescript",
)

Run with: node watch.js

The watch mode will:

  • Run an initial test pass
  • Watch specified paths for file changes
  • Re-build (if buildCommand provided) and re-run tests on changes
  • Debounce rapid file changes

Running Tests

// Run a single suite
runSuite(mySuite)

// Run multiple suites
runSuites([suite1, suite2, suite3])

License

MIT