Skip to content

Commit 0ae1910

Browse files
lib: update skipPrototypeComparison to skipPrototype
1 parent 87e11ab commit 0ae1910

File tree

7 files changed

+32
-32
lines changed

7 files changed

+32
-32
lines changed

doc/api/assert.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,15 @@ The `Assert` class allows creating independent assertion instances with custom o
233233
changes:
234234
- version: REPLACEME
235235
pr-url: https://github.com/nodejs/node/pull/59762
236-
description: Added `skipPrototypeComparison` option.
236+
description: Added `skipPrototype` option.
237237
-->
238238

239239
* `options` {Object}
240240
* `diff` {string} If set to `'full'`, shows the full diff in assertion errors. Defaults to `'simple'`.
241241
Accepted values: `'simple'`, `'full'`.
242242
* `strict` {boolean} If set to `true`, non-strict methods behave like their
243243
corresponding strict methods. Defaults to `true`.
244-
* `skipPrototypeComparison` {boolean} If set to `true`, skips prototype and constructor
244+
* `skipPrototype` {boolean} If set to `true`, skips prototype and constructor
245245
comparison in deep equality checks. Defaults to `false`.
246246

247247
Creates a new assertion instance. The `diff` option controls the verbosity of diffs in assertion error messages.
@@ -255,7 +255,7 @@ assertInstance.deepStrictEqual({ a: 1 }, { a: 2 });
255255

256256
**Important**: When destructuring assertion methods from an `Assert` instance,
257257
the methods lose their connection to the instance's configuration options (such
258-
as `diff`, `strict`, and `skipPrototypeComparison` settings).
258+
as `diff`, `strict`, and `skipPrototype` settings).
259259
The destructured methods will fall back to default behavior instead.
260260

261261
```js
@@ -269,7 +269,7 @@ const { strictEqual } = myAssert;
269269
strictEqual({ a: 1 }, { b: { c: 1 } });
270270
```
271271

272-
The `skipPrototypeComparison` option affects all deep equality methods:
272+
The `skipPrototype` option affects all deep equality methods:
273273

274274
```js
275275
class Foo {
@@ -292,7 +292,7 @@ const assert1 = new Assert();
292292
assert1.deepStrictEqual(foo, bar); // AssertionError
293293

294294
// Skip prototype comparison - passes if properties are equal
295-
const assert2 = new Assert({ skipPrototypeComparison: true });
295+
const assert2 = new Assert({ skipPrototype: true });
296296
assert2.deepStrictEqual(foo, bar); // OK
297297
```
298298

doc/api/util.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,15 +1565,15 @@ changes:
15651565

15661566
* `val1` {any}
15671567
* `val2` {any}
1568-
* `skipPrototypeComparison` {boolean} If `true`, prototype and constructor
1568+
* `skipPrototype` {boolean} If `true`, prototype and constructor
15691569
comparison is skipped during deep strict equality check. **Default:** `false`.
15701570
* Returns: {boolean}
15711571

15721572
Returns `true` if there is deep strict equality between `val1` and `val2`.
15731573
Otherwise, returns `false`.
15741574

15751575
By default, deep strict equality includes comparison of object prototypes and
1576-
constructors. When `skipPrototypeComparison` is `true`, objects with
1576+
constructors. When `skipPrototype` is `true`, objects with
15771577
different prototypes or constructors can still be considered equal if their
15781578
enumerable properties are deeply strictly equal.
15791579

lib/assert.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const NO_EXCEPTION_SENTINEL = {};
9393
* @property {'full'|'simple'} [diff='simple'] - If set to 'full', shows the full diff in assertion errors.
9494
* @property {boolean} [strict=true] - If set to true, non-strict methods behave like their corresponding
9595
* strict methods.
96-
* @property {boolean} [skipPrototypeComparison=false] - If set to true, skips comparing prototypes
96+
* @property {boolean} [skipPrototype=false] - If set to true, skips comparing prototypes
9797
* in deep equality checks.
9898
*/
9999

@@ -107,7 +107,7 @@ function Assert(options) {
107107
throw new ERR_CONSTRUCT_CALL_REQUIRED('Assert');
108108
}
109109

110-
options = ObjectAssign({ __proto__: null, strict: true, skipPrototypeComparison: false }, options);
110+
options = ObjectAssign({ __proto__: null, strict: true, skipPrototype: false }, options);
111111

112112
const allowedDiffs = ['simple', 'full'];
113113
if (options.diff !== undefined) {
@@ -313,7 +313,7 @@ Assert.prototype.deepStrictEqual = function deepStrictEqual(actual, expected, me
313313
throw new ERR_MISSING_ARGS('actual', 'expected');
314314
}
315315
if (isDeepEqual === undefined) lazyLoadComparison();
316-
if (!isDeepStrictEqual(actual, expected, this?.[kOptions]?.skipPrototypeComparison)) {
316+
if (!isDeepStrictEqual(actual, expected, this?.[kOptions]?.skipPrototype)) {
317317
innerFail({
318318
actual,
319319
expected,
@@ -339,7 +339,7 @@ function notDeepStrictEqual(actual, expected, message) {
339339
throw new ERR_MISSING_ARGS('actual', 'expected');
340340
}
341341
if (isDeepEqual === undefined) lazyLoadComparison();
342-
if (isDeepStrictEqual(actual, expected, this?.[kOptions]?.skipPrototypeComparison)) {
342+
if (isDeepStrictEqual(actual, expected, this?.[kOptions]?.skipPrototype)) {
343343
innerFail({
344344
actual,
345345
expected,

lib/internal/util/comparisons.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,8 +1028,8 @@ module.exports = {
10281028
isDeepEqual(val1, val2) {
10291029
return detectCycles(val1, val2, kLoose);
10301030
},
1031-
isDeepStrictEqual(val1, val2, skipPrototypeComparison) {
1032-
if (skipPrototypeComparison) {
1031+
isDeepStrictEqual(val1, val2, skipPrototype) {
1032+
if (skipPrototype) {
10331033
return detectCycles(val1, val2, kStrictWithoutPrototypes);
10341034
}
10351035
return detectCycles(val1, val2, kStrict);

lib/util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,11 +487,11 @@ module.exports = {
487487
isArray: deprecate(ArrayIsArray,
488488
'The `util.isArray` API is deprecated. Please use `Array.isArray()` instead.',
489489
'DEP0044'),
490-
isDeepStrictEqual(a, b, skipPrototypeComparison) {
490+
isDeepStrictEqual(a, b, skipPrototype) {
491491
if (internalDeepEqual === undefined) {
492492
internalDeepEqual = require('internal/util/comparisons').isDeepStrictEqual;
493493
}
494-
return internalDeepEqual(a, b, skipPrototypeComparison);
494+
return internalDeepEqual(a, b, skipPrototype);
495495
},
496496
promisify,
497497
stripVTControlCharacters,

test/parallel/test-assert-class.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ test('Assert class non strict with simple diff', () => {
479479
}
480480
});
481481

482-
// Shared setup for skipPrototypeComparison tests
482+
// Shared setup for skipPrototype tests
483483
{
484484
const message = 'Expected values to be strictly deep-equal:\n' +
485485
'+ actual - expected\n' +
@@ -507,8 +507,8 @@ test('Assert class non strict with simple diff', () => {
507507
const modern = new Modern(42);
508508
const legacy = new Legacy(42);
509509

510-
test('Assert class strict with skipPrototypeComparison', () => {
511-
const assertInstance = new Assert({ skipPrototypeComparison: true });
510+
test('Assert class strict with skipPrototype', () => {
511+
const assertInstance = new Assert({ skipPrototype: true });
512512

513513
assert.throws(
514514
() => assertInstance.deepEqual([1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 9, 7]),
@@ -535,8 +535,8 @@ test('Assert class non strict with simple diff', () => {
535535
assertInstance.deepStrictEqual(arr, buf);
536536
});
537537

538-
test('Assert class non strict with skipPrototypeComparison', () => {
539-
const assertInstance = new Assert({ strict: false, skipPrototypeComparison: true });
538+
test('Assert class non strict with skipPrototype', () => {
539+
const assertInstance = new Assert({ strict: false, skipPrototype: true });
540540

541541
assert.throws(
542542
() => assertInstance.deepStrictEqual([1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 9, 7]),
@@ -547,8 +547,8 @@ test('Assert class non strict with simple diff', () => {
547547
assertInstance.deepStrictEqual(modern, legacy);
548548
});
549549

550-
test('Assert class skipPrototypeComparison with complex objects', () => {
551-
const assertInstance = new Assert({ skipPrototypeComparison: true });
550+
test('Assert class skipPrototype with complex objects', () => {
551+
const assertInstance = new Assert({ skipPrototype: true });
552552

553553
function ComplexAwesomeClass(name, age) {
554554
this.name = name;
@@ -582,8 +582,8 @@ test('Assert class non strict with simple diff', () => {
582582
);
583583
});
584584

585-
test('Assert class skipPrototypeComparison with arrays and special objects', () => {
586-
const assertInstance = new Assert({ skipPrototypeComparison: true });
585+
test('Assert class skipPrototype with arrays and special objects', () => {
586+
const assertInstance = new Assert({ skipPrototype: true });
587587

588588
const arr1 = [1, 2, 3];
589589
const arr2 = new Array(1, 2, 3);
@@ -604,8 +604,8 @@ test('Assert class non strict with simple diff', () => {
604604
);
605605
});
606606

607-
test('Assert class skipPrototypeComparison with notDeepStrictEqual', () => {
608-
const assertInstance = new Assert({ skipPrototypeComparison: true });
607+
test('Assert class skipPrototype with notDeepStrictEqual', () => {
608+
const assertInstance = new Assert({ skipPrototype: true });
609609

610610
assert.throws(
611611
() => assertInstance.notDeepStrictEqual(cool, awesome),
@@ -615,12 +615,12 @@ test('Assert class non strict with simple diff', () => {
615615
const notAwesome = new AwesomeClass('Not so awesome');
616616
assertInstance.notDeepStrictEqual(cool, notAwesome);
617617

618-
const defaultAssertInstance = new Assert({ skipPrototypeComparison: false });
618+
const defaultAssertInstance = new Assert({ skipPrototype: false });
619619
defaultAssertInstance.notDeepStrictEqual(cool, awesome);
620620
});
621621

622-
test('Assert class skipPrototypeComparison with mixed types', () => {
623-
const assertInstance = new Assert({ skipPrototypeComparison: true });
622+
test('Assert class skipPrototype with mixed types', () => {
623+
const assertInstance = new Assert({ skipPrototype: true });
624624

625625
const obj1 = { value: 42, nested: { prop: 'test' } };
626626

test/parallel/test-util-isDeepStrictEqual.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ function notUtilIsDeepStrict(a, b) {
9494
utilIsDeepStrict(a, b);
9595
}
9696

97-
// Handle `skipPrototypeComparison` for isDeepStrictEqual
97+
// Handle `skipPrototype` for isDeepStrictEqual
9898
{
99-
test('util.isDeepStrictEqual with skipPrototypeComparison', () => {
99+
test('util.isDeepStrictEqual with skipPrototype', () => {
100100
function ClassA(value) { this.value = value; }
101101

102102
function ClassB(value) { this.value = value; }
@@ -123,7 +123,7 @@ function notUtilIsDeepStrict(a, b) {
123123
assert.strictEqual(util.isDeepStrictEqual(uint8Array, buffer, true), true);
124124
});
125125

126-
test('util.isDeepStrictEqual skipPrototypeComparison with complex scenarios', () => {
126+
test('util.isDeepStrictEqual skipPrototype with complex scenarios', () => {
127127
class Parent { constructor(x) { this.x = x; } }
128128
class Child extends Parent { constructor(x, y) { super(x); this.y = y; } }
129129

0 commit comments

Comments
 (0)