---
title: Run Type Check Before Tests
impact: HIGH
impactDescription: Type errors are often the root cause of test failures
tags: ci, typescript, type-check
---
## Паспорт документа

- Статус документа: living standard
- Актуально на: 28 марта 2026 года
- Владелец: backend/platform-команда
- Пересмотр: при изменении инженерной практики, CI/CD, архитектурных правил или локального workflow
- Область применения: внутренние rule/reference-card документы для инженерной команды
- Связанные документы:
  - [Индекс Agents](../README.md)
  - [Команды разработки](../commands.md)
  - [Инженерные принципы](../../governance/engineering-principles.md)

## Run Type Check Before Tests

**Impact: HIGH**

Always run `pnpm type-check` before running tests. Many test failures are caused by type errors. Fixing types first often resolves test issues.

### Order of Checks

1. `pnpm type-check` — Fix type errors first
2. `pnpm lint` — Fix linting issues
3. `pnpm test` — Run unit tests
4. `pnpm e2e` — Run E2E tests (if needed)

### After Schema Changes

If you changed `schema.prisma`, always regenerate types first:

```bash
pnpm --filter=api prisma generate
pnpm type-check
```

### Rules
- Type errors before test failures — fix types first
- If CI fails, run `pnpm type-check` locally before debugging tests
- Missing type errors after `prisma generate` usually mean stale generated client
- Run type check on changed packages: `pnpm --filter=web type-check`
