Skip to content

Repository files navigation

rjest

Crates.io npm PyPI License: MIT CI Documentation

A blazing-fast, drop-in replacement for Jest. Warm runs complete in ~14ms — 100x faster than standard Jest. Zero configuration changes required.

Website · Documentation · GitHub

rjest keeps a Rust daemon (jestd) running in the background, caching SWC transforms and pre-warming Node.js workers across test invocations. It reads your existing jest.config.* files with zero config changes and supports the same CLI flags you already use: --watch, --coverage, --runInBand, --testNamePattern, --json, --machine.

Installation

# npm (recommended for Node.js projects)
npm install -D rjest-install

# Homebrew (macOS / Linux)
brew tap neul-labs/tap
brew install rjest

# Cargo (Rust toolchain) — installs the `jest` CLI and `jestd` daemon
cargo install rjest-cli jestd

# pip (Python ecosystem)
pip install rjest-install

See CHANGELOG.md for release notes.

Quick Start

# Run all tests — daemon starts automatically on first use
npx rjest

# Watch mode
npx rjest --watch

# Coverage
npx rjest --coverage

# Filter by test name
npx rjest --testNamePattern="add"

# Structured JSON / machine output for CI & AI agents
npx rjest --json
npx rjest --machine

Why rjest?

Metric rjest Jest Speedup
Cold start 1.9s 1.4s 0.7x
Warm run ~14ms 1.4s ~100x
  • 100x faster warm runs — amortized config parsing, transform caching, and worker pooling
  • Zero config — reads jest.config.js, jest.config.ts, or package.json Jest settings automatically
  • Drop-in replacement — same CLI flags, test syntax, matchers, snapshots, and coverage
  • Built for AI agents--json and --machine flags provide structured, parse-friendly output
  • Persistent caching — SWC transforms cached on disk via sled; survive daemon restarts

Architecture

┌─────────────┐     IPC (nng)      ┌──────────────┐
│   jest CLI  │  ◄──────────────►  │    jestd     │
│  (rjest)    │                    │   (Rust)     │
└─────────────┘                    └──────┬───────┘
                                        │
                     ┌──────────────────┼──────────────────┐
                     │                  │                  │
                ┌────▼────┐      ┌────▼────┐      ┌────▼────┐
                │ Worker 1│      │ Worker 2│      │ Worker N│
                │ (Node)  │      │ (Node)  │      │ (Node)  │
                └─────────┘      └─────────┘      └─────────┘
  1. Rust daemon (jestd) — parses Jest config once, builds a dependency graph, watches the filesystem, and maintains a pool of warm Node.js workers.
  2. SWC Transforms — TypeScript/JSX compiled natively in Rust and cached by content hash (blake3). No Babel or ts-jest required.
  3. Worker Pool — persistent Node.js processes execute tests in a VM context, avoiding repeated V8 cold-start overhead.
  4. CLI Shim — forwards commands to the daemon over low-latency IPC (nng), then renders Jest-style output.

Daemon Management

# Check daemon status
npx rjest --daemon-status

# Stop the daemon (caches persist on disk)
npx rjest --daemon-stop

# Force a cold restart
npx rjest --daemon-restart

Compatibility

  • Node.js: 16+
  • Platforms: macOS (Intel & Apple Silicon), Linux (x86_64 & aarch64), Windows (x86_64)
  • Config files: jest.config.js, jest.config.ts, jest.config.mjs, package.json
  • Matchers: toBe, toEqual, toThrow, toHaveBeenCalled, resolves, rejects, etc.
  • Features: snapshots, fake timers, jest.fn(), jest.mock(), coverage (Istanbul), watch mode

See the compatibility matrix for full details.

AI Agent Usage

# Fast, structured output for automated workflows
npx rjest --onlyChanged --machine

# Filter by test name pattern
npx rjest --testNamePattern="authentication" --json

Why agents benefit

  • 14ms feedback loops — warm runs return results in ~14 milliseconds instead of seconds, enabling rapid edit-test cycles
  • Structured output--json and --machine flags provide parse-friendly results with file paths, test names, durations, and error details
  • Selective execution — run only relevant tests by name pattern or file path
  • Session continuity — the daemon maintains state across invocations, so agents don't pay cold-start costs repeatedly

Technology Choices

  • nng (nanomsg-next-gen) — low-latency IPC between CLI and daemon via Unix domain sockets
  • SWC — native Rust TypeScript/JSX compilation, 10-100x faster than Babel
  • sled — embedded disk cache for transforms keyed by content hash (blake3)
  • rayon — parallelizes file transforms across CPU cores

Documentation

Contributing

Contributions are welcome! Please open an issue to discuss significant changes before submitting a PR.

# Clone and build
git clone https://github.com/neul-labs/rjest.git
cd rjest
cargo build

# Run tests
cargo test

Part of the Neul Labs toolchain

Explore the rest of the Neul Labs developer tools:

Project Description
rpytest Run your pytest suite faster. Change nothing.
rninja Drop-in Ninja replacement with built-in caching.
gity Make large Git repositories feel instant.
stkd Stacked diffs for GitHub and GitLab.
grite The issue tracker that lives in your repo. Built for AI agents.

Learn more at neullabs.com.

License

MIT

Releases

Packages

Contributors

Languages