[AI Dev Tools Zoomcamp] Node.js test runner hangs when testing Socket.io and Express integration
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 85/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- express, javascript, node.js
調査の方向性
まず、server/index.js、tests/integration.test.js、package.json に対して issue で提案されている変更を確認します。文書化されたガイダンスが、サーバーのガード付き起動、Socket.io と HTTP サーバーのクリーンアップ、テストコマンドを網羅していることを検証します。FAQ でハングまたは ERR_SERVER_ALREADY_LISTEN エラーを防ぐ方法が明確に説明されていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Course & Homework
- Course: AI Dev Tools Zoomcamp (2026)
- Module: Homework 2 - Build and Ship an AI-Assisted Full-Stack App
Problem Description
When running integration tests for a collaborative full-stack application using Node.js's built-in test runner (node --test) against an Express and Socket.io server, the test process hangs indefinitely in the terminal after executing, or fails with ERR_SERVER_ALREADY_LISTEN.
Root Cause
- Premature port binding: If
server.listen(PORT)is executed at the top level ofserver/index.js, importing the app/server intotests/integration.test.jscauses the HTTP server to bind before the test hook can bind to an ephemeral port (0). - Open handles: Socket.io and
http.Servermaintain persistent event loop connections and internal heartbeat timers, preventing Node's test runner from detecting an empty event loop.
Solution & Best Practice
-
Guard
server.listeninserver/index.js:
Ensure the server only listens when executed directly, not when imported by test suites:if (require.main === module) { server.listen(PORT, () => { console.log(`Server listening on port ${PORT}`); }); } -
Explicitly close both
ioandserverin the test cleanup hook:after(async () => { io.close(); await new Promise((resolve) => serverInstance.close(resolve)); }); -
Use
--test-force-exitinpackage.json:
Add--test-force-exitso Node exits cleanly once all tests pass:"scripts": { "test": "node --test --test-force-exit tests/*.test.js" }
- 主要言語
- Python
- スター
- 7
- フォーク
- 19
- 平均マージ
- 9日 22時間
- マージ済み PR(30日)
- 10
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DataTalksClub/faq のほかの issue
-
[FAQ] How to fix "ValueError: Only sparse matrices with 32-bit integer indices are accepted" with DictVectorizer対応中かも @github-actions が 1 日前に担当しました。 オープンfaq-proposal
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
DataTalksClub/faq#493 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
[FAQ]Homework 4 (2026) Q2/Q6対応中かも @github-actions が 2 日前に担当しました。 オープンfaq-proposal
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
DataTalksClub/faq#491 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
[FAQ] Homework 4 (2026) Q2/Q6: Why does my model's AUC (0.732) lose to `lead_score` alone, and why does C=0.001 beat C=1?対応中かも @github-actions が 2 日前に担当しました。 オープンfaq-proposal
難易度 1/5 1時間未満 初心者へのやさしさ 87/100
DataTalksClub/faq#489 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
DataTalksClub/faq#486 ·
メンテナーはふだん 2 日以内に返信
-
[FAQ]対応中かも @github-actions が 4 日前に担当しました。 オープンfaq-proposal
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
DataTalksClub/faq#484 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
DataTalksClub/faq の issue をすべて見る
似ている issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
WLAN-Pi/wlanpi-profiler#341 ·
メンテナーはふだん 1 日以内に返信
-
Memory leak: the shared `validation_aborted_error` keeps every traceback it is raised through対応中かも @Fire162 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
graphql-python/graphql-core#287 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
roman-corgi/ctc-dip#160 ·
メンテナーはふだん 1 日以内に返信
-
type-bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
render_findings.py reads and writes in the host's default encoding, so findings.html breaks on a cp1252 Windows host対応中かも @Aaqibhafeezkhan が今日担当しました。 オープンbug good first issue mentored python size: XS up-for-grabs
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
dheerajjha/mcp-migrate#366 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信