31 lines
923 B
Markdown
31 lines
923 B
Markdown
|
|
# Testing
|
||
|
|
|
||
|
|
See `TESTING.md` at the project root for the full guide.
|
||
|
|
|
||
|
|
## Required Coverage
|
||
|
|
|
||
|
|
Tests are required for all new features. Do not consider a feature complete until tests are written and passing.
|
||
|
|
|
||
|
|
| What you're adding | Required test |
|
||
|
|
|---|---|
|
||
|
|
| Model function | Unit test in co-located `__tests__/` directory |
|
||
|
|
| Route loader/action | Unit or integration test for the logic |
|
||
|
|
| Utility function | Unit test |
|
||
|
|
| Component with non-trivial logic | Component test (React Testing Library) |
|
||
|
|
| Critical user flow | Cypress E2E test |
|
||
|
|
|
||
|
|
## Test Locations
|
||
|
|
|
||
|
|
- **Unit / component tests**: `__tests__/` directories co-located with source files
|
||
|
|
- **E2E tests**: `cypress/e2e/`
|
||
|
|
- **Fixtures**: `app/test/fixtures/`
|
||
|
|
|
||
|
|
## Commands
|
||
|
|
|
||
|
|
```bash
|
||
|
|
npm run test:run # unit tests, run once
|
||
|
|
npm test # unit tests, watch mode
|
||
|
|
npm run test:e2e:headless # Cypress headless
|
||
|
|
npm run test:all # everything
|
||
|
|
```
|