Executando verificação de segurança...
2

Oh meu Deus, os testes não passaram (ajuda) - Tabnews Open Source Development

Fala pessoal, tudo beleza?

Por falta de informação sobre onde pedir ajuda em relação ao projeto open source do tabnews, decidi usar o próprio. Certeza que temos alguns dos contribuidores do projeto que utilizam a plataforma e espero que consigam de dar uma ajudinha.

A Bronca

Eu nunca trabalhei dentro da comunidade open source, e como indicação de um professor decidi começar a contruibuir. O tabnews foi uma das possibilidades que veio direto na minha cabeça. Seguindo as instruções consegui instalar e rodar o projeto sem problemas, mas como indicado na documentação, antes de realizar quaisquer modificações seria necessário realizar os testes rodando o comando:

npm test

Após executar esse comando no repo recem clonado varios testes falharam, e agora?

Aqui seguem os logs:

[vitest]  ❯ tests/integration/api/v1/contents/[username]/[slug]/patch.test.js  (90 tests) 30029ms
[vitest]  ❯ tests/integration/api/v1/contents/post.test.js  (87 tests) 30015ms
[vitest]  ❯ tests/integration/api/v1/contents/get.test.js  (28 tests) 30007ms
[vitest]  ❯ tests/integration/api/v1/contents/[username]/get.test.js  (12 tests) 30002ms
[vitest]  ❯ tests/integration/api/v1/users/[username]/patch.test.js  (26 tests) 30011ms
[vitest]  ❯ tests/integration/api/v1/users/post.test.js  (25 tests) 30013ms
[vitest]  ❯ tests/integration/api/v1/user/get.test.js  (15 tests) 30013ms
[vitest]  ❯ tests/integration/api/v1/users/[username]/delete.test.js  (7 tests) 30008ms
[vitest]  ❯ tests/integration/api/v1/contents/[username]/[slug]/tabcoins/post.test.js  (11 tests | 2 skipped) 30004ms
[vitest]  ❯ tests/integration/api/v1/contents/[username]/[slug]/root/get.test.js  (11 tests) 30008ms
[vitest]  ❯ tests/integration/models/event.test.js  (16 tests) 30009ms
[vitest]  ❯ tests/integration/api/v1/contents/[username]/[slug]/children/get.test.js  (6 tests) 30003ms
[vitest]  ❯ tests/integration/api/v1/contents/[username]/[slug]/get.test.js  (11 tests) 30008ms
[vitest]  ❯ tests/integration/api/v1/contents/[username]/[slug]/parent/get.test.js  (10 tests) 30016ms
[vitest]  ❯ tests/integration/api/v1/sessions/post.test.js  (15 tests) 30015ms
[vitest]  ❯ tests/integration/api/v1/users/get.test.js  (11 tests) 30002ms
[vitest]  ❯ tests/integration/api/v1/email-confirmation/patch.test.js  (10 tests) 30008ms
[vitest]  ❯ tests/integration/api/v1/recovery/patch.test.js  (11 tests) 30005ms
[vitest]  ❯ tests/integration/api/v1/contents/[username]/[slug]/thumbnail/get.test.js  (9 tests) 30005ms
[vitest]  ❯ tests/integration/api/v1/recovery/post.test.js  (10 tests) 30011ms
[vitest]  ❯ tests/integration/api/v1/activation/patch.test.js  (10 tests) 30006ms
[vitest]  ✓ tests/unit/models/reward.test.js  (53 tests) 15ms
[vitest]  ✓ tests/unit/models/prestige.test.js  (62 tests) 6ms
[vitest]  ❯ tests/integration/api/v1/contents/firewall.post.test.js  (2 tests | 2 failed) 60020ms
[vitest]    ❯ tests/integration/api/v1/contents/firewall.post.test.js > POST /api/v1/contents [FIREWALL] > Default user > Spamming valid "root" contents
[vitest]      → Hook timed out in 30000ms.
[vitest] If this is a long-running hook, pass a timeout value as the last argument or configure it globally with "hookTimeout".
[vitest]    ❯ tests/integration/api/v1/contents/firewall.post.test.js > POST /api/v1/contents [FIREWALL] > Default user > Spamming valid "child" contents
[vitest]      → Hook timed out in 30000ms.
[vitest] If this is a long-running hook, pass a timeout value as the last argument or configure it globally with "hookTimeout".
[vitest]  ❯ tests/integration/api/v1/users/[username]/get.test.js  (7 tests) 30004ms
[vitest]  ❯ tests/integration/api/v1/_use-cases/registration-flow.test.js  (5 tests) 30003ms
[vitest]  ❯ tests/integration/api/v1/contents/rss/get.test.js  (4 tests) 30012ms
[vitest]  ❯ tests/integration/api/v1/status/votes/get.test.js  (5 tests) 30009ms
[vitest]  ❯ tests/integration/api/v1/sessions/delete.test.js  (4 tests) 30004ms
[vitest]  ✓ tests/unit/infra/email.test.js  (6 tests) 94ms
[vitest]  ✓ tests/unit/models/controller.test.js  (8 tests) 3ms
[vitest]  ✓ tests/unit/infra/under-maintenance.test.js  (9 tests) 14ms
[vitest]  ❯ tests/integration/api/v1/migrations/get.test.js  (4 tests) 30015ms
[vitest]  ❯ tests/integration/api/v1/migrations/post.test.js  (3 tests) 30012ms
[vitest]  ❯ tests/integration/api/v1/users/firewall.post.test.js  (1 test) 30004ms
[vitest]  ❯ tests/integration/infra/under-maintenance.test.js  (3 tests) 30004ms
[vitest]  ✓ tests/unit/models/transactional/index.test.js  (4 tests) 11ms
[vitest]  ❯ tests/integration/api/v1/status/get.test.js  (1 test) 30014ms
[vitest]  ❯ tests/integration/api/v1/user/post.test.js  (1 test) 30002ms
[vitest]  ❯ tests/integration/api/v1/sessions/get.test.js  (1 test) 30014ms
[vitest]  ❯ tests/integration/api/v1/contents/options.test.js  (1 test) 30013ms
[vitest]  ✓ tests/integration/api/v1/swr/get.test.js  (1 test) 14ms
[vitest]  ✓ tests/unit/interface/utils/error-message.test.js  (9 tests) 3ms
[vitest]  ✓ tests/unit/interface/components/Markdown/plugins/remove-duplicate-clobber-prefix.test.js  (2 tests) 1ms
[vitest]  ✓ tests/unit/interface/components/Pagination/index.test.js  (4 tests) 42ms
[vitest]  ✓ tests/unit/interface/utils/trusted-domain.test.js  (4 tests) 3ms
[vitest] 
**[vitest] ⎯⎯⎯⎯⎯⎯ Failed Suites 34 ⎯⎯⎯⎯⎯⎯**
[vitest]
[vitest]  FAIL  tests/integration/infra/under-maintenance.test.js [ tests/integration/infra/under-maintenance.test.js ]
[vitest]  FAIL  tests/integration/models/event.test.js [ tests/integration/models/event.test.js ]
[vitest]  FAIL  tests/integration/api/v1/activation/patch.test.js [ tests/integration/api/v1/activation/patch.test.js ]
[vitest]  FAIL  tests/integration/api/v1/contents/get.test.js [ tests/integration/api/v1/contents/get.test.js ]
[vitest]  FAIL  tests/integration/api/v1/contents/options.test.js [ tests/integration/api/v1/contents/options.test.js ]
[vitest]  FAIL  tests/integration/api/v1/contents/post.test.js [ tests/integration/api/v1/contents/post.test.js ]
[vitest]  FAIL  tests/integration/api/v1/email-confirmation/patch.test.js [ tests/integration/api/v1/email-confirmation/patch.test.js ]
[vitest]  FAIL  tests/integration/api/v1/migrations/get.test.js [ tests/integration/api/v1/migrations/get.test.js ]
[vitest]  FAIL  tests/integration/api/v1/migrations/post.test.js [ tests/integration/api/v1/migrations/post.test.js ]
[vitest]  FAIL  tests/integration/api/v1/recovery/patch.test.js [ tests/integration/api/v1/recovery/patch.test.js ]
[vitest]  FAIL  tests/integration/api/v1/recovery/post.test.js [ tests/integration/api/v1/recovery/post.test.js ]
[vitest]  FAIL  tests/integration/api/v1/sessions/delete.test.js [ tests/integration/api/v1/sessions/delete.test.js ]
[vitest]  FAIL  tests/integration/api/v1/sessions/get.test.js [ tests/integration/api/v1/sessions/get.test.js ]
[vitest]  FAIL  tests/integration/api/v1/sessions/post.test.js [ tests/integration/api/v1/sessions/post.test.js ]
[vitest]  FAIL  tests/integration/api/v1/status/get.test.js [ tests/integration/api/v1/status/get.test.js ]
[vitest]  FAIL  tests/integration/api/v1/user/get.test.js [ tests/integration/api/v1/user/get.test.js ]
[vitest]  FAIL  tests/integration/api/v1/user/post.test.js [ tests/integration/api/v1/user/post.test.js ]
[vitest]  FAIL  tests/integration/api/v1/users/firewall.post.test.js [ tests/integration/api/v1/users/firewall.post.test.js ]
[vitest]  FAIL  tests/integration/api/v1/users/get.test.js [ tests/integration/api/v1/users/get.test.js ]
[vitest]  FAIL  tests/integration/api/v1/users/post.test.js [ tests/integration/api/v1/users/post.test.js ]
[vitest]  FAIL  tests/integration/api/v1/_use-cases/registration-flow.test.js [ tests/integration/api/v1/_use-cases/registration-flow.test.js ]
[vitest]  FAIL  tests/integration/api/v1/contents/rss/get.test.js > GET /recentes/rss
[vitest]  FAIL  tests/integration/api/v1/contents/[username]/get.test.js [ tests/integration/api/v1/contents/[username]/get.test.js ]
[vitest]  FAIL  tests/integration/api/v1/status/votes/get.test.js [ tests/integration/api/v1/status/votes/get.test.js ]
[vitest]  FAIL  tests/integration/api/v1/users/[username]/delete.test.js [ tests/integration/api/v1/users/[username]/delete.test.js ]
[vitest]  FAIL  tests/integration/api/v1/users/[username]/get.test.js [ tests/integration/api/v1/users/[username]/get.test.js ]
[vitest]  FAIL  tests/integration/api/v1/users/[username]/patch.test.js [ tests/integration/api/v1/users/[username]/patch.test.js ]
[vitest]  FAIL  tests/integration/api/v1/contents/[username]/[slug]/get.test.js [ tests/integration/api/v1/contents/[username]/[slug]/get.test.js ]
[vitest]  FAIL  tests/integration/api/v1/contents/[username]/[slug]/patch.test.js [ tests/integration/api/v1/contents/[username]/[slug]/patch.test.js ]
[vitest]  FAIL  tests/integration/api/v1/contents/[username]/[slug]/children/get.test.js [ tests/integration/api/v1/contents/[username]/[slug]/children/get.test.js ]
[vitest]  FAIL  tests/integration/api/v1/contents/[username]/[slug]/parent/get.test.js [ tests/integration/api/v1/contents/[username]/[slug]/parent/get.test.js ]
[vitest]  FAIL  tests/integration/api/v1/contents/[username]/[slug]/root/get.test.js [ tests/integration/api/v1/contents/[username]/[slug]/root/get.test.js ]
[vitest]  FAIL  tests/integration/api/v1/contents/[username]/[slug]/tabcoins/post.test.js [ tests/integration/api/v1/contents/[username]/[slug]/tabcoins/post.test.js ]
[vitest]  FAIL  tests/integration/api/v1/contents/[username]/[slug]/thumbnail/get.test.js [ tests/integration/api/v1/contents/[username]/[slug]/thumbnail/get.test.js ]
[vitest] Error: Hook timed out in 30000ms.
[vitest] If this is a long-running hook, pass a timeout value as the last argument or configure it globally with "hookTimeout".
[vitest] ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/36]⎯
[vitest]
[vitest] **⎯⎯⎯⎯⎯⎯⎯ Failed Tests 2 ⎯⎯⎯⎯⎯⎯⎯**
[vitest]
[vitest]  FAIL  tests/integration/api/v1/contents/firewall.post.test.js > POST /api/v1/contents [FIREWALL] > Default user > Spamming valid "root" contents
[vitest]  FAIL  tests/integration/api/v1/contents/firewall.post.test.js > POST /api/v1/contents [FIREWALL] > Default user > Spamming valid "child" contents
[vitest] Error: Hook timed out in 30000ms.
[vitest] If this is a long-running hook, pass a timeout value as the last argument or configure it globally with "hookTimeout".
[vitest] ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/36]⎯
[vitest]
[vitest]  Test Files  35 failed | 11 passed (46)
[vitest]       Tests  2 failed | 162 passed | 2 skipped (635)
[vitest]    Start at  11:21:52
[vitest]    Duration  1120.18s (transform 3.81s, setup 56ms, collect 27.29s, tests 1080.53s, environment 9.66s, prepare 1.69s)
[vitest]
[vitest] vitest run exited with code 1
--> Sending SIGTERM to other processes..
1

Conspire, imagino que faltou subir algum serviço, por isso deu timeout. Parecem estar faltando alguns logs, por isso não consigo identificar exatamente o serviço que não subiu. Recomendo experimentar usar dois terminais separados: npm run dev, e confirmar que o serviço subiu corretamente, e em outro terminal npm run test:watch.

Ao ter uma dificuldade com o projeto, o ideal é criar um issue no repositório, assim quem está acompanhando o repositório com notificações será avisado e poderá te ajudar. Além disso, facilita a busca para caso outra pessoa tenha o mesmo problema ao executar o projeto.