assert: add partialDeepEqual to strict mode#62332
Closed
semimikoh wants to merge 1 commit intonodejs:mainfrom
Closed
assert: add partialDeepEqual to strict mode#62332semimikoh wants to merge 1 commit intonodejs:mainfrom
semimikoh wants to merge 1 commit intonodejs:mainfrom
Conversation
The `partialDeepStrictEqual` method was not re-exported as `partialDeepEqual` in strict assertion mode, unlike other methods such as `deepEqual` and `equal`. Add the alias so that strict mode users can call `assert.partialDeepEqual()` consistently with the existing naming convention. Fixes: nodejs#62327
Member
|
This doesn't really make sense, because there's no non-strict The aliases are there such that const { equal } = require("assert"); // loose equalis analogous to const { equal } = require("assert/strict"); // strict equalbut there is no analogous method here. const { partialDeepEqual } = require("assert"); // undefined |
Contributor
Author
|
That makes sense — I hadn't considered that the aliases exist to map existing non-strict methods to their strict counterparts, not just to remove the "Strict" suffix. Since there's no I'll close #62332. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62332 +/- ##
==========================================
+ Coverage 88.55% 89.68% +1.13%
==========================================
Files 703 676 -27
Lines 208259 206581 -1678
Branches 40162 39558 -604
==========================================
+ Hits 184415 185277 +862
+ Misses 15844 13447 -2397
+ Partials 8000 7857 -143
🚀 New features to boost your workflow:
|
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.
The
partialDeepStrictEqualmethod was not re-exported aspartialDeepEqualin strict assertion mode, unlike other methods such asdeepEqualandequal.Add the alias so that strict mode users can call
assert.partialDeepEqual()consistently with the existing naming convention.Fixes: #62327
When using
node:assert/strict, methods likedeepEqualandequalare automatically aliased to their strict counterparts. However,
partialDeepStrictEqualwas missing this alias.This PR adds the
partialDeepEqualalias in two places:Assertconstructor: whenoptions.strictis true,this.partialDeepEqual = this.partialDeepStrictEqualassert.strictobject:partialDeepEqualmapped toassert.partialDeepStrictEqualTests added in
test-assert-class.jsandtest-assert.jsfollowing the existing alias verification pattern.
Fixes: #62327