Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: pnpm install
- name: Run unit tests
working-directory: frontend_omni
run: pnpm test:unit
run: pnpm test

frontend-e2e:
runs-on: ubuntu-latest
Expand Down
26 changes: 12 additions & 14 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ modAI-chat is a full-stack application with separate backend and frontend compon

- **Backend**: Python FastAPI REST API with SQLModel persistence
- **Frontend**: React TypeScript SPA with modular architecture
- **E2E Tests**: Tests covering all different frontends with the (if needed) backend

## General Guidelines

Expand Down Expand Up @@ -68,7 +69,7 @@ Before any backend work, read relevant architecture documents:
### Testing

- **Framework**: pytest
- **Command**: `uv run pytest`
- **Command**: `uv run pytest` or `uv run pytest tests/test_*.py`
- **Location**: `backend/tests/`
- **Test Coverage**: Always add unit tests for new features or bug fixes
- **Test Isolation**: Use mocking for external dependencies
Expand All @@ -79,6 +80,7 @@ Before any backend work, read relevant architecture documents:
- **Dictionary Storage**: Use SQLAlchemy's `JSON` type for dictionary fields
- **Timestamps**: All HTTP API timestamps in UTC ISO 8601 format


## modAI Frontend Development

### Environment Setup
Expand Down Expand Up @@ -111,25 +113,21 @@ Before any backend work, read relevant architecture documents:
- **JSX Functions**: JSX should never have a render.. function, but always a proper component function. Compnent functions should never be nested in other functions but on top level
- **pnpm dev**: You should never run `pnpm dev` because this is blocking. Use `pnpm build` instead always.

## Testing Commands

### Backend
### Unit Testing

```bash
cd backend
uv run pytest # Run all tests
uv run pytest tests/test_*.py # Run specific test file
cd frontend_omni
pnpm test # Run javascript unit tests (vitest)
pnpm check # Run linter
```

### Frontend

```bash
cd frontend_omni
pnpm test:unit # Run javascript unit tests (vitest)
pnpm test:ui # Run full ui tests (Playwright)
pnpm build # Build for production
pnpm lint # Run linter
```
## E2E Testing

**Note**: Only read this section when working with e2e tests.

For comprehensive e2e testing best practices and patterns, refer to `e2e_tests/BEST_PRACTICES.md`.

## Development Workflow

Expand Down
28 changes: 28 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,34 @@ Run tests with:
uv run pytest
```

### vscode

When using vscode to run tests in the editor, make sure to configure the root dir for pytests
properly in the `.vscode/settings.json`:

```json
{
"python.testing.pytestArgs": [],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.testing.cwd": "${workspaceFolder}/backend"
}
```

## Code Quality

To check code formatting with ruff:

```bash
uv run ruff format --check .
```

To automatically format code with ruff:

```bash
uv run ruff format .
```

## 👥 Shared Responsibility

| Component | Responsibility |
Expand Down
Loading