• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

reactivando / use-pubsub-js / 28131253287
100%
master: 80%

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 24 Jun 2026 09:38PM UTC
Jobs 1
Files 4
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

24 Jun 2026 09:37PM UTC coverage: 100.0%. Remained the same
28131253287

push

github

web-flow
feat!: route subscriber errors to a configurable onError (default console.error) (#83)

* feat!: route subscriber errors to a configurable onError (default console.error)

A throwing subscriber previously re-threw asynchronously via setTimeout, which
terminates a Node host process when no uncaughtException handler is registered
(fine in browsers — asymmetric and dangerous for SSR/edge/test runners). The
security audit rated this the top runtime risk.

- createBus/createPubSub accept `onError?: (error: unknown) => void`, defaulting
  to console.error. Delivery to the other subscribers always continues.
- New exported `ErrorHandler` type.
- Tests: onError invoked with the error and never re-throws (mutation of intent
  vs the old re-throw test); default-to-console.error; isolation preserved.
- e2e smoke (CJS + ESM): a throwing subscriber does not crash the process.

BREAKING CHANGE: subscriber errors no longer re-throw asynchronously; they go to
onError (default console.error). Pass `createPubSub({ onError })` to customize,
or `onError: (e) => { setTimeout(() => { throw e }) }` to restore the old behavior.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(pubsub): guard against a throwing onError; strengthen error tests

Adversarial review found that a user onError that itself throws would propagate
out of the delivery setTimeout and re-introduce the uncaught-exception crash
(and abort delivery to remaining subscribers). Wrap the onError call in its own
try/catch (EventEmitter-style) so it can never crash the host.

Tests from review:
- a throwing onError neither crashes delivery nor stops other subscribers
- default sink asserts console.error is called WITH the thrown error
- contract spec asserts the error reached the default sink (errSpy called once)
- e2e (CJS+ESM): a throwing subscriber on the PubSub singleton does not crash

107 tests, 100% coverage, e2e 10/10.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthr... (continued)

26 of 26 branches covered (100.0%)

Branch coverage included in aggregate %.

7 of 7 new or added lines in 1 file covered. (100.0%)

167 of 167 relevant lines covered (100.0%)

36.35 hits per line

Jobs
ID Job ID Ran Files Coverage
1 28131253287.1 24 Jun 2026 09:38PM UTC 4
100.0
GitHub Action Run
Source Files on build 28131253287
  • Tree
  • List 4
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #28131253287
  • b680b959 on github
  • Prev Build on main (#28130530224)
  • Next Build on main (#28131737072)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc