Testing best practices for Hydrogen
When testing your Hydrogen app, make sure you have accounted for any issues that might occur when customers visit your live storefront.
This guide describes best practices for testing your Hydrogen app.
Running testsAnchor link to section titled "Running tests"
You can use the following command to run tests in development:
To run tests in a continuous-integration (CI) environment like GitHub Actions, you can use the following command:
Catching common issuesAnchor link to section titled "Catching common issues"
Hydrogen rulesAnchor link to section titled "Hydrogen rules"
|server-component-banned-hooks||Prevents using the
These state handling hooks don't function as expected in React Server Components because server components execute only once for each request on the server.
|client-component-banned-hooks||Prevents using the
|prefer-image-component||Prevents using the
Images can cause layout shifts if they load after the surrounding page has already rendered. This can lead to Cumulative Layout Shift, a Core Web Vital that Google uses in search ranking.