Skip to content

fix: early returns for around hooks#30

Merged
fratzinger merged 6 commits into
mainfrom
fix/around-early-return
May 11, 2026
Merged

fix: early returns for around hooks#30
fratzinger merged 6 commits into
mainfrom
fix/around-early-return

Conversation

@fratzinger
Copy link
Copy Markdown
Member

This pull request enhances the iff, iffElse, and checkMulti hooks to support Feathers "around" hooks by properly handling the next() callback, and adds comprehensive test coverage for these scenarios. It also refactors and modernizes test code, removes unnecessary TypeScript error suppressions, and improves type safety and clarity throughout the test suite.

The most important changes are:

Support for "around" hooks and next() callback:

  • Updated iff and iffElse hooks to accept and properly handle the next callback, ensuring correct sequencing and compatibility with Feathers "around" hooks. This includes changes to their implementation and to the internal callHooks utility. [1]R1, [2] [3] [4] [5]
  • Enhanced the checkMulti hook to support "around" hooks by calling next() when appropriate, and added new tests to cover these cases. [1] [2] [3]

Expanded and improved test coverage:

  • Added comprehensive tests for "around" hook behavior in iff, iffElse, and checkMulti, including async predicate handling and correct sequencing of inner hooks and next(). [1] [2] [3]

Test code modernization and cleanup:

  • Removed outdated TypeScript @ts-expect-error comments and refactored tests to use async/await and proper type assertions, improving readability and reliability. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
  • Added missing imports for vi and expect from vitest in test files. [1] [2] [3]

Minor improvements:

  • Allowed optional parameters in test predicate functions for better flexibility.
  • Updated .claude/settings.json to allow Bash(npm run *) commands.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 11, 2026

Deploying feathers-utils with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3329eb8
Status: ✅  Deploy successful!
Preview URL: https://9915c24b.feathers-utils.pages.dev
Branch Preview URL: https://fix-around-early-return.feathers-utils.pages.dev

View logs

@fratzinger fratzinger merged commit 69c6309 into main May 11, 2026
9 checks passed
@fratzinger fratzinger deleted the fix/around-early-return branch May 11, 2026 09:26
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