Repository navigation
Add assert.rejects() and assert.doesNotReject() - #359
Merged
Merged
Conversation
Co-authored-by: nev21 <82737406+nev21@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add assert.rejects() and assert.doesNotReject() functions
Add assert.rejects() and assert.doesNotReject()
Oct 27, 2026
nev21
approved these changes
Oct 27, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #359 +/- ##
==========================================
- Coverage 97.05% 97.03% -0.02%
==========================================
Files 323 324 +1
Lines 16848 16893 +45
Branches 4595 4525 -70
==========================================
+ Hits 16351 16392 +41
- Misses 497 501 +4
🚀 New features to boost your workflow:
|
nev21
enabled auto-merge (squash)
October 27, 2026 05:37
nevware21-bot
approved these changes
Oct 27, 2026
nevware21-bot
left a comment
Contributor
There was a problem hiding this comment.
Approved by nevware21-bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tripwire's
assertAPI had no equivalent of Node'sassert.rejects()andassert.doesNotReject(), so migrating users had to wrapawaitintry/catch. This adds both functions.core/src/assert/funcs/rejects.ts)throwsFunc, so the criteria (constructor, instance, string or RegExp, plusmsgMatch) matchthrows.doesNotRejectiscreateNotAdapter(rejectsFunc), mirroringdoesNotThrow.throws, mismatch failures read "expected … to throw …" rather than "reject". I kept that to avoid duplicating the matching logic. The messages could be reworded if you prefer.assertClass.tswithnArgs: 3.IAssertClass.tshas the typings and TypeDoc. They are marked@since 0.2.0and typed asPromiseLike<AssertInst>.assert.rejects.test.tscovers resolve and reject paths, criteria mismatch, a synchronous throw, a non-promise input, and negation.migrating-from-node-assert.md: the two functions move from "not available" to the supported mapping table, and the workaround snippet is replaced.docs/README.md: the function list and the migration diff are updated.CHANGELIST.md: new entry under v0.2.0.migrating-from-jest.mdis unchanged. Its Jest.rejectsmatcher row is about theexpectside, which this PR does not add.