Automated testing
Overview of the testing tools available in the project
This boilerplate comes with various testing setups to ensure your application's reliability and robustness.
Files related to this page
Unit & Integration Testing
Vitest is a solid, popular and battle tested solution built on top of the Vite ecosystem for unit and integration testing by millions of developers. One of its most notable advantages over Jest is performance, some of the teams reported up to 10-20x speed increase in running tests, even in watch mode.
Vitest and Jest compatibility
While Vitest is a newer solution, it can be a drop-in replacement for Jest, with all the advantages on your side. Consider checking out this article in vitest docs
Run pnpm run test
to run the tests.
Refer to the Predefined Scripts file for more information on the available scripts.
End-to-End Testing
Playwright is used for end-to-end testing.
- Run
pnpm run e2e:headless
to run the tests in headless mode. - Run
pnpm run e2e:ui
to run the tests in UI mode.
Refer to the Predefined Scripts file for more information on the available scripts.
Acceptance Testing
To write acceptance tests, we leverage Storybook's play function. This allows you to interact with your components and test various user flows within Storybook.
Smoke Testing
In this boilerplate, we use Storybook's out-of-the-box support for smoke testing to verify that components render correctly without any errors. Just run pnpm run test-storybook to perform smoke testing. Remember to write stories in JSX or TSX format only. Smoke testing and a lot of other functionalities dont work well with MDX stories.