Enhance development workflow with Docker integration
- Updated CONTRIBUTING.md to clarify the use of Makefile targets for running tasks inside Docker, eliminating the need for local Go or Node installations. - Introduced docker-compose.tools.yml for backend and frontend tools, allowing for streamlined testing, linting, and formatting. - Created Dockerfile.tools to set up a Go environment with necessary tools for testing and linting. - Modified Makefile to include separate targets for backend and frontend tests, improving clarity and usability. - Updated documentation in development.md and testing.md to reflect the new Docker-based workflow for running tests and development tasks.
This commit is contained in:
@@ -12,42 +12,20 @@ description: Runs backend (Go) and frontend (Vitest) tests for the hnh-map monor
|
||||
|
||||
## What to run
|
||||
|
||||
This repo has two test suites. Run the one(s) that match the changed code, or both if unsure.
|
||||
Tests run **in Docker** via the Makefile; no local Go or Node is required.
|
||||
|
||||
### Backend (Go)
|
||||
From the repo root, use:
|
||||
|
||||
From repo root:
|
||||
- **Both backend and frontend:** `make test` (runs backend then frontend tests in Docker).
|
||||
- **Backend only:** `make test-backend`
|
||||
- **Frontend only:** `make test-frontend`
|
||||
|
||||
```bash
|
||||
make test
|
||||
```
|
||||
|
||||
Or:
|
||||
|
||||
```bash
|
||||
go test ./...
|
||||
```
|
||||
|
||||
Uses temp dirs and in-memory DBs; no external services needed.
|
||||
|
||||
### Frontend (Vitest)
|
||||
|
||||
From repo root:
|
||||
|
||||
```bash
|
||||
npm --prefix frontend-nuxt run test
|
||||
```
|
||||
|
||||
Or from `frontend-nuxt/`:
|
||||
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
These use `docker-compose.tools.yml`; the first run may build the backend-tools image.
|
||||
|
||||
## Scope
|
||||
|
||||
- **Backend-only changes** (e.g. `internal/`, `cmd/`): run `make test`.
|
||||
- **Frontend-only changes** (e.g. `frontend-nuxt/`): run `npm --prefix frontend-nuxt run test`.
|
||||
- **Both or unclear**: run backend then frontend.
|
||||
- **Backend-only changes** (e.g. `internal/`, `cmd/`): run `make test-backend`.
|
||||
- **Frontend-only changes** (e.g. `frontend-nuxt/`): run `make test-frontend`.
|
||||
- **Both or unclear**: run `make test`.
|
||||
|
||||
Report pass/fail and any failing test names or errors.
|
||||
|
||||
Reference in New Issue
Block a user