Skip to content

Conversation

@boneskull
Copy link
Owner

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.

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.
Copilot AI review requested due to automatic review settings January 17, 2026 00:16
Copy link
Owner Author

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

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 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.
Copilot AI review requested due to automatic review settings January 18, 2026 01:06
@boneskull boneskull added the chore tooling & overhead label Jan 18, 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 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
@boneskull boneskull added the documentation Improvements or additions to documentation label Jan 18, 2026
@boneskull boneskull merged commit f4051e4 into main Jan 18, 2026
14 checks passed
@boneskull boneskull deleted the custom-assertions branch January 18, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore tooling & overhead documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants