Skip to content

feat: DRY adapter base, add Next.js/Hono/Fastify adapters, migrate tests to vitest#97

Closed
Sarita-Joshi wants to merge 2 commits into
trycatchal:masterfrom
Sarita-Joshi:feat/dry-adapters-and-tests
Closed

feat: DRY adapter base, add Next.js/Hono/Fastify adapters, migrate tests to vitest#97
Sarita-Joshi wants to merge 2 commits into
trycatchal:masterfrom
Sarita-Joshi:feat/dry-adapters-and-tests

Conversation

@Sarita-Joshi

Copy link
Copy Markdown
Contributor
  • Extract shared HandlerConfig type, defineHandler, and prepareHipthrustable into src/adapter.ts so all framework adapters reuse the same base
  • Add Next.js App Router adapter (src/next.ts) with gatherContext for async pre-lifecycle work
  • Add Hono adapter (src/hono.ts)
  • Add Fastify adapter (src/fastify.ts)
  • Slim Express adapter to use shared base
  • Fix pre-existing bug: transformThrowPossiblyAsync now catches sync throws from async-capable functions
  • Migrate test/index.test.ts from mocha/chai to vitest, fix nested it() bug
  • Add comprehensive test suites: adapter, lifecycle, HipError, type-safety, and per-adapter integration tests (131 tests total)
  • Add hello-world examples for Express, Hono, Fastify, and Next.js
  • Add hono, fastify, next as optional peer dependencies

Removes the @hapi/boom dependency entirely and replaces it with a
lightweight HipError class defined in core.ts. This gives hipthrusts
its own error type with no external dependencies, making it simpler
for consumers (no need to import or know about boom).

HipError has statusCode, message, and a static isHipError() type guard.
Adapters catch HipError directly instead of checking Boom.isBoom().

BREAKING CHANGE: Consumers that caught Boom errors from hipthrusts
should now catch HipError instead. The .output property is preserved
for backwards compatibility with existing adapter code.
…sts to vitest

- Extract shared HandlerConfig type, defineHandler, and prepareHipthrustable
  into src/adapter.ts so all framework adapters reuse the same base
- Add Next.js App Router adapter (src/next.ts)
- Add Hono adapter (src/hono.ts)
- Add Fastify adapter (src/fastify.ts)
- Slim Express adapter to use shared base
- Fix pre-existing bug: transformThrowPossiblyAsync now catches sync throws
- Migrate test/index.test.ts from mocha/chai to vitest
- Fix pre-existing nested it() bug in type error test case
- Add comprehensive test suites (131 tests total)
- Add hello-world examples for Express, Hono, Fastify, and Next.js
- Add hono, fastify, next as optional peer dependencies
trycatchal added a commit that referenced this pull request May 29, 2026
…tests to vitest (#101)

Salvages the still-relevant parts of PR #97, rewritten to fit master's current
transport-agnostic architecture (kind-based HipError hierarchy, executeHipthrustable(full, raw)):

- Fix transformThrowPossiblyAsync so synchronous throws from async-capable
  stages are caught and transformed instead of leaking the raw error
- Add hono/fastify/next adapters built on a shared, framework-free http-adapter
  base; map HipError.kind to HTTP status via new hipErrorToStatus helper
- Migrate the test suite from mocha/chai to vitest and add adapter, lifecycle,
  and error coverage (55 tests)
- Add runnable hello-world examples for each adapter
- Standardize the repo on pnpm (scripts, CI, docs, packageManager)

https://claude.ai/code/session_016DKjeFeqSoks634RUdkUAK

Co-authored-by: Claude <noreply@anthropic.com>
@trycatchal

Copy link
Copy Markdown
Owner

moved to different PR ... thanks for the help!

@trycatchal trycatchal closed this May 29, 2026
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.

2 participants