Skip to content

Commit e919a84

Browse files
committed
feat(ci): Vitest, testes da API e workflow GitHub Actions
- Extrai createJobsApiApp para testar Express sem subir porta - Testes de getConfig e rotas /api (health, jobs, 404) - Scripts npm test, validate e validate:ci - Workflow CI em pull_request e push (master, develop) - README: secao Testes e CI e estrutura do projeto Made-with: Cursor
1 parent 0d54046 commit e919a84

9 files changed

Lines changed: 2037 additions & 115 deletions

File tree

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master, develop]
7+
8+
jobs:
9+
validate:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: "22"
17+
cache: npm
18+
cache-dependency-path: package-lock.json
19+
20+
- name: Instalar dependencias (raiz)
21+
run: npm ci
22+
23+
- name: Testes backend
24+
run: npm test
25+
26+
- name: Instalar dependencias (frontend)
27+
run: npm ci --prefix frontend
28+
29+
- name: Lint frontend
30+
run: npm run lint --prefix frontend
31+
32+
- name: Build frontend
33+
run: npm run build --prefix frontend

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,30 @@ Bot de automacao para buscar vagas no LinkedIn com foco em Brasil remoto e expor
1818
- `src/linkedinScraper.js`: coleta HTTP, paginacao e extracao das vagas
1919
- `src/exporter.js`: geracao de Excel e PDF
2020
- `src/logger.js`: logs padronizados
21+
- `src/jobsApiApp.js`: monta as rotas da API Express (reutilizado nos testes)
22+
- `src/server.js`: entrypoint da API (`dotenv` + listen)
23+
- `test/`: testes automatizados (Vitest)
24+
25+
## Testes e CI (validar antes do PR)
26+
27+
O workflow [`.github/workflows/ci.yml`](.github/workflows/ci.yml) roda testes do backend, lint e build do frontend em PRs e em push para `master` e `develop`. No GitHub, ative *branch protection* com o check **CI / validate** obrigatorio se quiser bloquear merge com falha.
28+
29+
**Com dependencias ja instaladas** (raiz + `frontend`):
30+
31+
```bash
32+
npm run validate
33+
```
34+
35+
**Espelho do que o CI faz** (reinstala com `npm ci` na raiz e no frontend — mais lento, util antes de abrir PR):
36+
37+
```bash
38+
npm run validate:ci
39+
```
40+
41+
Outros comandos:
42+
43+
- `npm test` — apenas testes (Vitest)
44+
- `npm run test:watch` — Vitest em modo observacao
2145

2246
## Requisitos
2347

0 commit comments

Comments
 (0)