JavaScript testing
A testing framework is used to run unit tests, for example:
- Jest — the most popular JavaScript application testing framework by Facebook.
- Vitest — brand new framework based on Vite.
The main frameworks have their own libraries that help to test components, for example
- Vue Testing Library built on top of Vue Test Utils
- React Testing Library built on top of React Test Utilities
Cypress is used for end-to-end testing.
Component testing
It is necessary to check:
- Differences in rendering with different input parameters (props);
- Differences in rendering depending on the properties and computed properties of the global storage (store)
- Component handles custom events, input fields
- Component calls external functions
- Component calls actions and mutations in store
- Required changes in child components take place
Links
JavaScript
- Jest — Delightful JavaScript Testing Framework by Facebook
- JavaScript & Node.js testing best practices — Yoni Goldberg, GitHub (2022)
- Тестирование JavaScript от А до Я (Jest, React Testing Library, e2e, screenshot) — Ulbi TV (2022) 🇷🇺
Vue.js
- Vue Testing Handbook — Lachlan Miller (2022)
- Vue Testing Handbook — Lachlan Miller (2022)
- Vue Test Utils — The official testing suite utils for Vue.js 3
- Vue Testing Library Test Examples — GitHub
- Vitest Runner — A simple WebStorm plugin to run Vitest tests
End-to-end
- Cypress — End-to-end test runner