Skip to main content
The preact/test-utils package provides utilities to help test Preact components in a test environment.

Installation

Importing

Available utilities

The test-utils package exports three main functions:

setupRerender

Set up synchronous rendering for tests

act

Flush effects and renders in tests

teardown

Clean up test environment

Basic usage

Source reference

Implementation: test-utils/src/index.js Type definitions: test-utils/src/index.d.ts