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

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

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 24 Jun 2026 07:52PM 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 07:51PM UTC coverage: 100.0%. Remained the same
28125469748

push

github

web-flow
feat(hooks)!: typed bus param + Events generic; widen message; rename useSubscribe types (#77)

* feat(hooks)!: typed bus param + Events generic; widen message; rename useSubscribe types

- Both hooks accept an optional `bus` (defaults to the `PubSub` singleton) so a
  `createPubSub<E>()` bus can be driven through the hooks with typed payloads,
  closing the createPubSub<->hooks disconnect.
- Add an `Events` generic for end-to-end payload inference (token + message and
  handler argument typed from the event map; defaults preserve untyped behavior).
- Widen `usePublish` `message` from `string` to `unknown`, matching
  `PubSub.publish<T>` — any payload can now be published through the hook.
- Rename `UseSubscriptionParams`/`UseSubscriptionResponse` to
  `UseSubscribeParams`/`UseSubscribeResponse` for parity with `UsePublish*`.
- Update README (bus param, typed-hooks example, API tables, migration notes)
  and add integration tests for typed bus, isolation, bus-change re-subscribe,
  and non-string payloads. Ignore *.tgz packaging artifacts.

BREAKING CHANGE: `UseSubscriptionParams`/`UseSubscriptionResponse` are renamed to
`UseSubscribeParams`/`UseSubscribeResponse`; `usePublish` `message` is now
`unknown` instead of `string`.

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

* fix(usePublish): don't swallow valid falsy auto-publish payloads; address review

Adversarial review of the typed-hooks change found that widening `message` to
`unknown` made the `isAutomatic && message` truthiness guard silently skip valid
falsy payloads (0, false). Guard now skips only the unset sentinels
(undefined / null / empty string), preserving the original empty-string behavior
while letting 0/false/NaN publish. Mutation-verified: the new test fails against
the old guard.

Also from review:
- Add integration coverage for a custom bus: automatic publish, unmount cleanup
  (the others — typed delivery, isolation, bus-change re-subscribe — already added... (continued)

26 of 26 branches covered (100.0%)

Branch coverage included in aggregate %.

11 of 11 new or added lines in 2 files covered. (100.0%)

165 of 165 relevant lines covered (100.0%)

32.76 hits per line

Jobs
ID Job ID Ran Files Coverage
1 28125469748.1 24 Jun 2026 07:52PM UTC 4
100.0
GitHub Action Run
Source Files on build 28125469748
  • Tree
  • List 4
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #28125469748
  • fa60f82a on github
  • Prev Build on main (#28118410624)
  • Next Build on main (#28125782649)
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