Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permitir filtrar testes em qualquer modo de execução #1644

Merged
merged 1 commit into from
Mar 8, 2024
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
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Há várias formas de rodar os testes dependendo do que você deseja fazer, mas
npm test
```

Caso queira manter os serviços e testes rodando enquanto desenvolve (e rodando novamente a cada alteração salva), use o comando abaixo:
Caso queira manter os serviços e testes rodando enquanto desenvolve (e rodando novamente a cada alteração salva), use o modo `watch` com o comando abaixo:

```bash
npm run test:watch:services
Expand All @@ -104,17 +104,17 @@ npm run dev
npm run test:watch
```

Caso não queira dar `watch` em todos os testes e queira isolar arquivos específicos de teste, você pode utilizar uma expressão regular (`regex`) para dar `match` no que quiser. Não é necessário digitar o caminho inteiro para o arquivo, veja alguns exemplos abaixo:
Caso não queira executar (ou dar `watch`) em todos os testes e queira isolar arquivos específicos de teste, você pode filtrar pelo caminho. Não é necessário digitar o caminho inteiro para o arquivo e você também pode fornecer mais de um caminho, veja alguns exemplos abaixo:

```bash
# Rodar todos os testes de "users" da api "v1"
npm run test:watch -- v1/users/
# Rodar todos os testes de "users" e "status" da api "v1"
npm run test -- v1/users/ v1/status/

# Rodar apenas o arquivo tests/integration/api/v1/_use-cases/registration-flow.test.js
npm run test:watch -- registration-flow
npm run test -- registration-flow

# Rodar apenas o arquivo tests/integration/api/v1/contents/[username]/patch.test.js
npm run test:watch -- username./patch
npm run test:watch:services -- username./patch

# Rodar apenas o arquivo tests/integration/api/v1/contents/[username]/[slug]/get.test.js
npm run test:watch -- contents/.username./.slug./get
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@
"services:stop": "npm run docker:compose -- stop",
"services:down": "npm run docker:compose -- down",
"docker:compose": "docker compose --env-file .env -f infra/docker-compose.development.yml",
"concurrently": "kill-port 3000 && npm run services:up && concurrently -s -k -n next,jest \"npm run next\"",
"test": "npm run concurrently -- \"jest --runInBand\" --hide next --verbose || npm run services:stop",
"preconcurrently": "kill-port 3000 && npm run services:up",
"concurrently": "concurrently -s first -P -k -n next,jest \"npm run next\" \"jest --runInBand {@}\"",
"postconcurrently": "npm run services:stop",
"test": "npm run concurrently -- --hide next --",
"test:watch": "jest --runInBand --watchAll",
"test:watch:services": "npm run concurrently -- \"jest --runInBand --watchAll\" || npm run services:stop",
"test:watch:services": "npm run concurrently -- -- --watchAll",
"lint": "npm run lint:next && npm run lint:prettier",
"lint:next": "next lint --max-warnings=0 --dir .",
"lint:prettier": "prettier --check .",
Expand Down
Loading