How to use
- Copy the installation command and review the source package before installing it in your own agent environment.
- Check the source document for required tools, credentials and supported hosts.
- Describe your input and desired deliverable; review the output against the source material.
npx skills add https://github.com/augmnt/webdev-skills --skill writing-testsBefore you start
- Installation does not include a model subscription, API allowance or permission to access your files.
- Repository stars and installation counts describe activity, not an independent quality or security test.
Rendered from the source repository. Headings, examples, code, tables, links, and referenced images are preserved.
Writing Tests
Test behavior, not implementation. Prioritize by risk.
When to Use Each Type
| Type | What | When | Tools |
|---|---|---|---|
| Unit | Single function/hook | Pure logic, calculations | Vitest, Jest |
| Integration | Component + deps | Forms, data display | Testing Library |
| E2E | Full user flow | Critical paths | Playwright |
Always Test
- Auth flows
- Payment/checkout
- Data mutations (create, update, delete)
- Authorization rules
- Critical business logic
Rarely Test
- Static content
- Third-party internals
- Pure styling
File Organization
src/components/Button/
├── Button.tsx
└── Button.test.tsx # Colocated
e2e/ # E2E at root
├── auth.spec.ts
└── checkout.spec.tsPatterns
Arrange-Act-Assert
test('increments on click', () => {
// Arrange
render(<Counter initial={0} />)
// Act
fireEvent.click(screen.getByRole('button'))
// Assert
expect(screen.getByText('1')).toBeInTheDocument()
})Query Priority (best → worst)
getByRole- semantic, accessiblegetByLabelText- form inputsgetByText- contentgetByTestId- last resort
Test Behavior, Not Implementation
// ❌ Implementation
expect(component.state.isOpen).toBe(true)
// ✅ Behavior
expect(screen.getByRole('dialog')).toBeVisible()Minimum Viable Testing
If time-constrained:
- E2E for happy paths (covers most ground)
- Unit for complex logic (catches edge cases)
- Integration for critical components (forms, data)
Advanced Patterns
For API mocking, test fixtures, and coverage guidance, see MOCKING.md.



