assert: mark partialDeepStrictEqual() as stable

The current implementation is well tested, fast and handles all
known edge cases properly.

PR-URL: https://github.com/nodejs/node/pull/57370
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
This commit is contained in:
Ruben Bridgewater 2025-03-11 01:48:58 +01:00 committed by Node.js GitHub Bot
parent ebbc5f7017
commit d23b8a0cc4
5 changed files with 6 additions and 10 deletions

View File

@ -2594,9 +2594,13 @@ argument.
added: added:
- v23.4.0 - v23.4.0
- v22.13.0 - v22.13.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/57370
description: partialDeepStrictEqual is now Stable. Previously, it had been Experimental.
--> -->
> Stability: 1.2 - Release candidate > Stability: 2 - Stable
* `actual` {any} * `actual` {any}
* `expected` {any} * `expected` {any}

View File

@ -54,7 +54,7 @@ const {
isPromise, isPromise,
isRegExp, isRegExp,
} = require('internal/util/types'); } = require('internal/util/types');
const { isError, deprecate, emitExperimentalWarning } = require('internal/util'); const { isError, deprecate } = require('internal/util');
const { innerOk } = require('internal/assert/utils'); const { innerOk } = require('internal/assert/utils');
const CallTracker = require('internal/assert/calltracker'); const CallTracker = require('internal/assert/calltracker');
@ -358,7 +358,6 @@ assert.partialDeepStrictEqual = function partialDeepStrictEqual(
expected, expected,
message, message,
) { ) {
emitExperimentalWarning('assert.partialDeepStrictEqual');
if (arguments.length < 2) { if (arguments.length < 2) {
throw new ERR_MISSING_ARGS('actual', 'expected'); throw new ERR_MISSING_ARGS('actual', 'expected');
} }

View File

@ -101,15 +101,10 @@ suite('notEqualArrayPairs', () => {
makeBlock(assert.deepStrictEqual, arrayPair[0], arrayPair[1]), makeBlock(assert.deepStrictEqual, arrayPair[0], arrayPair[1]),
assert.AssertionError assert.AssertionError
); );
// TODO(puskin94): remove emitWarning override once the partialDeepStrictEqual method is not experimental anymore
// Suppress warnings, necessary otherwise the tools/pseudo-tty.py runner will fail
const originalEmitWarning = process.emitWarning;
process.emitWarning = () => {};
assert.throws( assert.throws(
makeBlock(assert.partialDeepStrictEqual, arrayPair[0], arrayPair[1]), makeBlock(assert.partialDeepStrictEqual, arrayPair[0], arrayPair[1]),
assert.AssertionError assert.AssertionError
); );
process.emitWarning = originalEmitWarning; // Restore original process.emitWarning
}); });
} }
}); });

View File

@ -1,4 +1,3 @@
// Flags: --no-warnings
'use strict'; 'use strict';
require('../common'); require('../common');
const assert = require('assert').strict; const assert = require('assert').strict;

View File

@ -1,4 +1,3 @@
// Flags: --no-warnings
'use strict'; 'use strict';
require('../common'); require('../common');
const assert = require('assert').strict; const assert = require('assert').strict;