Skip to content

Testing

Implement unit testing for your components using Jest. Automated testing ensures that your components work as expected and guards against regressions.

  1. snapshot testing is allowed for components
  2. be careful for unpredictable results (date, time)
  3. code coverage of >=70%

Vitest is a sensible alternative, which is mostly the same API as Jest. The difference is that vitest will run with vite-node as back-end. This is convenient if your setup already includes Vite.

Storybook is a powerful tool for developing UI components in isolation and documenting them with interactive examples. It allows you to view and interact with your components in various states, making it easier to understand and showcase their capabilities.

If your component library is part of a larger design system, you can use the designs addon.