rstest

Configure and write Preact unit tests with rstest patterns.

1|Updated Dec 30, 2025
One-click install
npx skills add https://github.com/Hyperxq/modular-frontend-architecture --skill rstest
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rstest
Source: https://github.com/Hyperxq/modular-frontend-architecture/tree/main/.claude/skills/rstest
Command: npx skills add https://github.com/Hyperxq/modular-frontend-architecture --skill rstest

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides consistent patterns and conventions for writing unit tests in Preact projects using rstest, reducing boilerplate and improving test reliability.

Core Features & Use Cases

  • Enforces using @rstest/core instead of vitest or jest for tests.
  • Promotes using @testing-library/preact and ensures the Preact JSX runtime is used.
  • Offers ready-to-use test patterns for component tests, setup, mocking, and async testing.
  • Guides configuration for rstest.config.ts and setup files to ensure clean test environments.

Quick Start

Run the test suite with bun run test to verify your Preact components using rstest.

Frequently Asked Questions about rstest

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up unit testing for Preact with rstest?

Configure unit testing for Preact with rstest by creating a rstest.config.ts file and a setup file to ensure automatic cleanup in afterEach. This enforces explicit import conventions and a clean test environment for your components.

Can I use testing-library with Preact and Rspack-native tooling?

Yes, testing-library works with Preact and Rspack-native tooling by applying @testing-library/preact. This ensures the Preact JSX runtime is used instead of React-based tooling for component rendering.

Why should I use @rstest/core instead of vitest or jest for Preact testing?

Using @rstest/core instead of vitest or jest provides consistent patterns and conventions for Preact projects using Rspack-native tooling. This approach reduces boilerplate and improves test reliability.

How do I mock components and handle asynchronous tests in Preact?

Mock components and handle asynchronous tests in Preact using ready-to-use rstest patterns. These patterns apply explicit import conventions to ensure reliable component testing and async behavior validation.

Do I need TypeScript to configure a clean test environment for rstest?

TypeScript is used to configure a clean test environment for rstest. The setup guides configuration for rstest.config.ts and setup files to ensure explicit imports and automatic cleanup in afterEach.