feat: DRY adapter base, add Next.js/Hono/Fastify adapters, migrate tests to vitest#97
Closed
Sarita-Joshi wants to merge 2 commits into
Closed
feat: DRY adapter base, add Next.js/Hono/Fastify adapters, migrate tests to vitest#97Sarita-Joshi wants to merge 2 commits into
Sarita-Joshi wants to merge 2 commits into
Conversation
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>
Owner
|
moved to different PR ... thanks for the help! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HandlerConfigtype,defineHandler, andprepareHipthrustableintosrc/adapter.tsso all framework adapters reuse the same basesrc/next.ts) withgatherContextfor async pre-lifecycle worksrc/hono.ts)src/fastify.ts)transformThrowPossiblyAsyncnow catches sync throws from async-capable functionstest/index.test.tsfrom mocha/chai to vitest, fix nestedit()bug