-
-
Notifications
You must be signed in to change notification settings - Fork 0
chore(bupkis): add some custom assertions #341
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
Replace try/catch patterns and generic 'to throw' assertions with
domain-specific custom assertions ('to pass', 'to fail') that better
express test intent when testing assertion behavior.
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 introduces custom test assertions ('to pass', 'to fail', 'to fail with message matching') to improve test readability and semantics when testing assertion behavior in the bupkis test suite. The refactoring replaces verbose try/catch patterns and generic 'to throw' assertions with domain-specific alternatives that better express test intent.
Changes:
- Added three new custom assertions with sync implementations in
custom-assertions.ts - Refactored test suite to use new custom assertions throughout, replacing try/catch boilerplate
- Created comprehensive test coverage for the new custom assertions
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/bupkis/test/custom-assertions.ts | Added passingAssertionSync, failingAssertionSync, and failingAssertionWithMessageSync custom assertions with documentation |
| packages/bupkis/test/custom-assertions.test.ts | New test file with comprehensive coverage of custom assertions including edge cases and negation |
| packages/bupkis/test/usage-examples.test.ts | Replaced 'to throw' with 'to fail' for assertion failure tests |
| packages/bupkis/test/standard-schema/valibot.test.ts | Replaced try/catch blocks with 'to throw an' assertions |
| packages/bupkis/test/standard-schema/interop.test.ts | Replaced try/catch blocks with 'to throw an' assertions |
| packages/bupkis/test/standard-schema/function-assertions.test.ts | Replaced try/catch with custom assertions; added regex pattern validation for sync tests |
| packages/bupkis/test/standard-schema/basic.test.ts | Replaced try/catch with custom assertions and regex pattern validation |
| packages/bupkis/test/core/expect.test.ts | Replaced 'not to throw' with 'to pass' and 'to throw' with 'to fail' |
| packages/bupkis/test/assertion/satisfy-deep-equal.test.ts | Replaced 'to throw' with 'to fail' throughout |
| packages/bupkis/test/assertion/async-iterable.test.ts | Replaced async try/catch blocks with expectAsync wrappers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…a tests Changed 'to reject with an AssertionError' to 'to reject with error satisfying' with regex patterns to validate the error message content that was lost during migration from try/catch.
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 10 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- reference how bupkis uses custom assertions - fix some composition examples to be more coherent

chore(bupkis): add some custom assertions
chore(bupkis): apply custom assertions to test suite
Replace try/catch patterns and generic 'to throw' assertions with
domain-specific custom assertions ('to pass', 'to fail') that better
express test intent when testing assertion behavior.