Migrate to Rstest

Goal

Migrate Jest/Vitest tests and config to Rstest with minimal behavior changes. Use the current Rstest migration docs for exact mappings; this skill adds scope, dependency, and cleanup guardrails.

Workflow

  1. Detect runner and scope (https://raw.githubusercontent.com/rstackjs/agent-skills/main/skills/migrate-to-rstest/references/detect-test-framework.md).
  2. Run dependency/version gates (https://raw.githubusercontent.com/rstackjs/agent-skills/main/skills/migrate-to-rstest/references/dependency-install-gate.md).
  3. Read only the needed deltas: Jest, Vitest, and/or global API replacement.
  4. Migrate scripts/config/setup before tests; prefer adapters or Rsbuild/Rspack config fixes before editing test bodies.
  5. Validate discovery/types/run, fixing failures in this order: dependency skew, config/resolver, setup/env/coverage, mocks/timers/snapshots, test bodies.
  6. After the scope is green, remove only scope-local legacy files and devDeps no remaining scope uses.
  7. Summarize changes, kept legacy files, unsupported fields, and TODOs.

Guardrails

High-risk Rstest deltas

Escalate before large edits

If the next fix requires many test edits or production source changes, stop and report: why smaller fixes failed, options, risks, and the recommended path.