Metadata-Version: 2.4
Name: rjest-install
Version: 0.1.2
Summary: A fast Jest-compatible test runner written in Rust
Author-email: Dipankar Sarkar <dipankarsarkar@outlook.com>
License: MIT
Project-URL: Homepage, https://github.com/neul-labs/rjest
Project-URL: Repository, https://github.com/neul-labs/rjest
Project-URL: Issues, https://github.com/neul-labs/rjest/issues
Keywords: jest,testing,rust,runner
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# rjest-install

[![PyPI version](https://img.shields.io/pypi/v/rjest-install.svg)](https://pypi.org/project/rjest-install/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![CI](https://github.com/neul-labs/rjest/actions/workflows/ci.yml/badge.svg)](https://github.com/neul-labs/rjest/actions/workflows/ci.yml)

> **A blazing-fast, drop-in replacement for Jest.** Install via pip and run your tests in ~14ms on warm runs — 100x faster than standard Jest.

`rjest-install` is the official PyPI distribution of **rjest**, a Rust-based test runner that keeps a background daemon (`jestd`) alive across invocations. It reads your existing `jest.config.*` files with zero configuration changes and supports the same CLI flags you already use (`--watch`, `--coverage`, `--runInBand`, `--testNamePattern`, `--json`, `--machine`).

## Why rjest?

- **100x faster warm runs** — 14ms vs 1.4s on typical TypeScript projects
- **Zero config** — reads `jest.config.js`, `jest.config.ts`, or `package.json` Jest settings automatically
- **Drop-in replacement** — same CLI flags, test syntax, matchers, and snapshot format
- **Built for AI agents** — structured JSON and `--machine` output for fast feedback loops
- **Persistent caching** — SWC transforms cached on disk via `sled`; survive restarts

## Installation

```bash
pip install rjest-install
```

Requires Python 3.8+ and a Rust binary (downloaded automatically on first run, or install via cargo / Homebrew).

## Quick Start

```bash
# Run all tests (daemon starts automatically)
jest

# Watch mode
jest --watch

# Coverage
jest --coverage

# Filter by test name
jest --testNamePattern="add"

# Structured JSON output for CI / AI agents
jest --json
jest --machine
```

## How It Works

1. **Daemon (`jestd`)** — a Rust process that runs in the background, parsing Jest config once, building a dependency graph, and pre-warming Node.js workers.
2. **SWC Transforms** — TypeScript/JSX is compiled natively in Rust and cached by content hash (blake3). No Babel or `ts-jest` needed.
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.

## Architecture

```
┌─────────────┐     IPC (nng)      ┌──────────────┐
│   jest CLI  │  ◄──────────────►  │    jestd     │
│  (rjest)    │                    │   (Rust)     │
└─────────────┘                    └──────┬───────┘
                                        │
                     ┌──────────────────┼──────────────────┐
                     │                  │                  │
                ┌────▼────┐      ┌────▼────┐      ┌────▼────┐
                │ Worker 1│      │ Worker 2│      │ Worker N│
                │ (Node)  │      │ (Node)  │      │ (Node)  │
                └─────────┘      └─────────┘      └─────────┘
```

## Daemon Management

```bash
# Check if the daemon is running
jest --daemon-status

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

# Force a cold restart
jest --daemon-restart
```

## Compatibility

- **Python**: 3.8+
- **Node.js**: 16+ (for running tests)
- **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](https://github.com/neul-labs/rjest/blob/main/docs/compatibility.md) for full details.

## Performance

| Metric | rjest | Jest | Speedup |
| --- | --- | --- | --- |
| Cold start | 1.9s | 1.4s | 0.7x |
| Warm run | **14ms** | 1.4s | **100x** |

## AI Agent Usage

```bash
# Fast, structured output for automated workflows
jest --onlyChanged --machine

# Filter by test name pattern
jest --testNamePattern="authentication" --json
```

## Other Installation Methods

- **npm**: `npm install -D rjest-install`
- **Homebrew**: `brew tap neul-labs/tap && brew install rjest`
- **Cargo**: `cargo install rjest`

## Documentation

- [Full Documentation](https://docs.neullabs.com/rjest)
- [Architecture](https://github.com/neul-labs/rjest/blob/main/docs/architecture.md)
- [Compatibility](https://github.com/neul-labs/rjest/blob/main/docs/compatibility.md)
- [Performance](https://github.com/neul-labs/rjest/blob/main/docs/performance.md)
- [Changelog](https://github.com/neul-labs/rjest/blob/main/CHANGELOG.md)

## Contributing

Contributions are welcome! Please open an issue or PR on the [main repository](https://github.com/neul-labs/rjest).

## License

MIT
