npm install --save-dev @testing-library/preact
This library is built on top of
DOM Testing Librarywhich is where most of the logic behind the queries is.
You want to write tests for your Preact components so that they avoid including implementation details, and are maintainable in the long run.
The Preact Testing Library is a very lightweight solution for testing Preact
components. It provides light utility functions on top of
in a way that encourages better testing practices. Its primary guiding principle
What this library is not:
- A test runner or framework.
- Specific to a testing framework.
We recommend Jest as our preference. You can checkout Using Without Jest if you're looking to use another framework.