Skip to content

Conversation

@boneskull
Copy link
Owner

@boneskull boneskull commented Jan 15, 2026

Summary

  • Add new @bupkis/supertest package with HTTP response assertions for bupkis
  • 14 assertions for testing status codes, headers, body content, and redirects
  • Works with supertest, superagent, fetch, axios, or any object with a numeric status property
  • Includes comprehensive documentation and 67 tests

Assertions

Category Assertions
Status to have status (exact code), to have status (category: ok/redirect/client error/server error)
Headers to have header (existence), to have header (exact value), to have header (regex)
Body to have body, to have body (string), to have JSON body, to have JSON body satisfying, to have body satisfying (regex/object)
Redirect to redirect, to redirect to (URL/regex)

Test plan

  • All 67 tests pass
  • Build succeeds
  • ESLint passes
  • Manual testing with actual HTTP responses (see examples/manual-test.ts)

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings January 15, 2026 05:00
Copy link
Contributor

Copilot AI left a 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.

Copilot AI review requested due to automatic review settings January 15, 2026 05:25
Copy link
Contributor

Copilot AI left a 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.

Copilot AI review requested due to automatic review settings January 15, 2026 05:33
@boneskull boneskull added enhancement New feature or request ecosystem ecosystem compat labels Jan 15, 2026
Copy link
Contributor

Copilot AI left a 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.

Copy link
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copilot AI review requested due to automatic review settings January 15, 2026 06:28
Copy link
Contributor

Copilot AI left a 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.

boneskull and others added 8 commits January 15, 2026 13:03
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)
Copilot AI review requested due to automatic review settings January 15, 2026 21:04
Copy link
Contributor

Copilot AI left a 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.

@boneskull boneskull merged commit de8ff5c into main Jan 15, 2026
20 checks passed
@boneskull boneskull deleted the supertest branch January 15, 2026 23:14
@github-actions github-actions bot mentioned this pull request Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ecosystem ecosystem compat enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants