-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat(supertest): add @bupkis/supertest HTTP response assertions #332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new @bupkis/supertest package providing HTTP response assertions for the Bupkis testing framework. The package includes 14 assertions for testing status codes, headers, body content, and redirects, designed to work with supertest, superagent, fetch, axios, or any object with a numeric status property.
Changes:
- New package with comprehensive HTTP response assertions covering status codes, headers, body validation, and redirect testing
- Complete test suite with 67 tests across guard functions and all assertion types
- Detailed documentation with examples for all assertion types
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/supertest/package.json | Package configuration with dependencies, scripts, and metadata |
| packages/supertest/src/assertions.ts | Core implementation with 14 HTTP response assertion functions |
| packages/supertest/src/guards.ts | Type guard functions for HTTP response validation |
| packages/supertest/src/schema.ts | Zod schema for HTTP response validation |
| packages/supertest/src/index.ts | Package entry point exporting assertions |
| packages/supertest/test/assertions.test.ts | Comprehensive test suite for all assertions |
| packages/supertest/test/guards.test.ts | Tests for HTTP response type guards |
| packages/supertest/tsconfig.json | TypeScript configuration |
| packages/supertest/README.md | Detailed documentation with usage examples |
| packages/supertest/LICENSE.md | License file |
| package-lock.json | Dependency lock file updates |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add package directory structure with package.json, tsconfig.json, and LICENSE.md. This provides the foundation for HTTP response assertions that work with supertest, fetch, and axios responses.
Add comprehensive HTTP response assertions for testing with supertest, superagent, fetch, or axios responses. Includes: - Status assertions (exact code and categories: ok/redirect/client error/server error) - Header assertions (existence, exact match, regex pattern) - Body assertions (existence, exact string, JSON, partial object match, regex) - Redirect assertions (is redirect, redirect to URL/pattern) All assertions support case-insensitive header matching and both 'headers' and 'header' property names for superagent compatibility. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove unused devDependencies (express, supertest, @types/*) - Remove individual assertion exports (only export supertestAssertions array) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add prettier config to match other packages - Simplify redundant isJsonResponse check Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add @bupkis/supertest to release-please configuration files for automated versioning and to the monorepo README plugins section.
Add ?? '' fallback to line 669 to match the pattern used at line 713 for defensive coding and consistency.
Adds examples/manual-test.ts that spins up a test server and verifies all assertions work correctly with actual fetch responses. Tests: - Status assertions (exact and category) - Header assertions (existence, exact value, pattern) - Body assertions (string, JSON, partial match, regex) - Redirect assertions (existence, exact URL, pattern) - Negation assertions
- Wrap stringify() in try-catch to gracefully handle circular references in response bodies (returns '[unserializable body]' on failure) - Update HttpResponseSchema JSDoc to mark as @internal and remove misleading import example (schema is not exported from main entry)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Summary
@bupkis/supertestpackage with HTTP response assertions for bupkisstatuspropertyAssertions
to have status(exact code),to have status(category: ok/redirect/client error/server error)to have header(existence),to have header(exact value),to have header(regex)to have body,to have body(string),to have JSON body,to have JSON body satisfying,to have body satisfying(regex/object)to redirect,to redirect to(URL/regex)Test plan
examples/manual-test.ts)🤖 Generated with Claude Code