Skip to content

fix(ci): --test-force-exit damit CI nicht mehr hängt - #4

Merged
rockywuest merged 1 commit into
masterfrom
fix/ci-test-force-exit
Apr 24, 2026
Merged

rockywuest merged 1 commit into
masterfrom
fix/ci-test-force-exit

Conversation

@rockywuest

Copy link
Copy Markdown
Owner

Problem

CI hängt seit 2026-03-30 unendlich lang, wird nach ~6h von GitHub gecancelled.
Lokaler Test zeigt: alle 194 Tests passen in ~650ms, aber der Node-Prozess exitiert nicht.

Root Cause

  • FileWatchConnector nutzt fs.watch() (plugins/nox-event-bus/connectors/filewatch.js:32)
  • SystemConnector nutzt setInterval() (plugins/nox-event-bus/connectors/system.js:30)
  • Tests haben korrekte afterEach-Cleanup (watcher.close(), clearInterval())
  • Aber auf Linux-CI halten die Handles den Event-Loop offen, obwohl sie geschlossen sind

Fix

--test-force-exit Flag (Node 22+) sorgt dafür, dass nach Abschluss aller Tests der Prozess sauber terminiert wird, unabhängig von hängenden Handles.

Verifikation

  • Vor Fix: npm test hängt >45s ohne Exit
  • Nach Fix: npm test beendet in 0.84s (194/194 passed)
  • Coverage unverändert

Alternative (nicht gewählt)

Man könnte stattdessen in fs.watch-basiertem Code explizit process._getActiveHandles() aufräumen, aber das ist fragil. --test-force-exit ist der offiziell supportete Node-Weg für genau diesen Fall.

Tests pass locally (194/194, ~650ms) but the process never exits in CI.
Root cause: FileWatchConnector uses fs.watch() and SystemConnector uses
setInterval — both have afterEach cleanup but fs.watch handles on Linux
sometimes stay open after close(), blocking process exit.

Node 22+ supports --test-force-exit which terminates cleanly after all
tests complete, regardless of dangling handles.

- Fixes hanging CI runs since 2026-03-30
- Tests still pass (0 errors) with same coverage
- Local run: 0.84s total (was: hang indefinitely)
@rockywuest
rockywuest merged commit 4176a4e into master Apr 24, 2026
2 checks passed
@rockywuest
rockywuest deleted the fix/ci-test-force-exit branch April 24, 2026 08:05
rockywuest added a commit that referenced this pull request Oct 17, 2026
…#4)

Tests pass locally (194/194, ~650ms) but the process never exits in CI.
Root cause: FileWatchConnector uses fs.watch() and SystemConnector uses
setInterval — both have afterEach cleanup but fs.watch handles on Linux
sometimes stay open after close(), blocking process exit.

Node 22+ supports --test-force-exit which terminates cleanly after all
tests complete, regardless of dangling handles.

- Fixes hanging CI runs since 2026-03-30
- Tests still pass (0 errors) with same coverage
- Local run: 0.84s total (was: hang indefinitely)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant