rstest

Installation
SKILL.md

Rstest

Rstest is a testing framework powered by Rspack. It provides Jest-compatible APIs with native TypeScript and ESM support, and integrates directly into the Rstack toolchain (Rspack, Rsbuild, Rslib, Rspress).

Key things that distinguish Rstest from Jest/Vitest:

  • Build tooling is Rspack, not Babel or Vite — it reuses your existing Rsbuild/Rspack config
  • Two separate utility namespaces: rs for module-level operations (mocking modules), and rstest for runtime utilities (fn, spyOn, timers). Both are imported from @rstest/core
  • rs.mock() without a factory is NOT auto-mock — it looks for __mocks__/ directory only. For auto-mocking, pass { mock: true }. This is the biggest gotcha when migrating from Vitest
  • Mock factories cannot be async — use import ... with { rstest: 'importActual' } for partial mocks instead
  • No --run flagrstest already runs once and exits. Use rstest --watch or rstest watch for watch mode
  • Node.js ≥ 20.19.0 required

Setup

Install

Related skills
Installs
2
GitHub Stars
20
First Seen
Mar 16, 2026