LearnNewsExamplesServices
Frontmatter
id8817
titleFix Unhandled Rejections in Base.initAsync and DomEvents.initDomEvents
stateClosed
labels
bugtestingcore
assigneestobiu
createdAtJan 19, 2026, 7:06 PM
updatedAtJan 19, 2026, 7:08 PM
githubUrlhttps://github.com/neomjs/neo/issues/8817
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 19, 2026, 7:08 PM

Fix Unhandled Rejections in Base.initAsync and DomEvents.initDomEvents

Closed v11.23.0 bugtestingcore
tobiu
tobiu commented on Jan 19, 2026, 7:06 PM

Unit tests were crashing with unhandled promise rejections (Neo.isDestroyed) during component destruction, specifically in initAsync (core.Base) and initDomEvents (mixin.DomEvents). These crashes destabilized the test worker process, causing subsequent tests (like Provider.spec.mjs) to fail with misleading TypeError: Neo.setupClass is not a function errors due to environment pollution or partial module loading.

Fixes:

  1. Wrap initAsync in src/core/Base.mjs with a try-catch block to suppress Neo.isDestroyed errors.
  2. Add .catch() block to the timeout promise in src/mixin/DomEvents.mjs initDomEvents to suppress Neo.isDestroyed.

These changes ensure robust test execution and prevent cascading failures.

tobiu added the bug label on Jan 19, 2026, 7:06 PM
tobiu added the testing label on Jan 19, 2026, 7:06 PM
tobiu added the core label on Jan 19, 2026, 7:06 PM
tobiu referenced in commit 1c163d4 - "fix: Handle Neo.isDestroyed rejections in initAsync and initDomEvents (#8817)" on Jan 19, 2026, 7:07 PM
tobiu assigned to @tobiu on Jan 19, 2026, 7:07 PM
tobiu
tobiu Jan 19, 2026, 7:07 PM

Input from Gemini 3 Pro:

✦ I have implemented the fixes for the unhandled rejections:

  1. src/core/Base.mjs: Wrapped the initAsync call in construct with a try-catch block to specifically swallow Neo.isDestroyed errors.
  2. src/mixin/DomEvents.mjs: Added a .catch() handler to the timeout promise in initDomEvents to swallow Neo.isDestroyed errors.

Running npm run test-unit now results in 227 passed tests with no unhandled rejections or worker crashes. This stabilizes the entire unit test suite.

tobiu closed this issue on Jan 19, 2026, 7:08 PM