Skip to content

test: add tests for error-handler#1056

Merged
serhalp merged 2 commits intomainfrom
jg/test-h3-h2-h1
Feb 6, 2026
Merged

test: add tests for error-handler#1056
serhalp merged 2 commits intomainfrom
jg/test-h3-h2-h1

Conversation

@43081j
Copy link
Collaborator

@43081j 43081j commented Feb 5, 2026

No description provided.

@vercel
Copy link

vercel bot commented Feb 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Feb 5, 2026 11:49pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Feb 5, 2026 11:49pm
npmx-lunaria Ignored Ignored Feb 5, 2026 11:49pm

Request Review

"@vue/test-utils": "2.4.6",
"axe-core": "4.11.1",
"fast-check": "4.5.3",
"h3": "1.15.5",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its a transitive dependency but we need it as a direct devDependency for sake of resolving types in tests

@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

This pull request adds the H3 package (version 1.15.5) to package.json as a development dependency and introduces a new unit test file at test/unit/server/utils/error-handler.spec.ts. The test suite covers handleApiError behaviour: re-throwing existing H3 errors, converting valibot validation errors to a 404 using the first issue message, returning provided fallback errors with their statusCode and message, defaulting fallback statusCode to 502 when absent, and honouring a custom fallback statusCode when supplied.

🚥 Pre-merge checks | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request has no description provided by the author, making it impossible to verify whether any description relates to the changeset. Add a descriptive pull request description explaining the purpose and scope of the error-handler tests and the h3 dependency addition.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jg/test-h3-h2-h1

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Comment on lines +18 to +23
let valibotError: unknown
try {
v.parse(schema, { name: '' })
} catch (e) {
valibotError = e
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really wanted to use safe parse and construct the v.ValiError yourself but it somehow feels like more work 🫠

@serhalp serhalp added this pull request to the merge queue Feb 6, 2026
Merged via the queue into main with commit 5ab76de Feb 6, 2026
20 checks passed
@serhalp serhalp deleted the jg/test-h3-h2-h1 branch February 6, 2026 01:57
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.

3 participants