process: remove process.assert

PR-URL: https://github.com/nodejs/node/pull/55035
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
Aviv Keller 2024-09-23 12:29:23 -04:00 committed by GitHub
parent b64006c0ed
commit c237eabf4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 41 deletions

View File

@ -2142,6 +2142,9 @@ parameter.
<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/55035
description: End-of-Life.
- version: v10.0.0
pr-url: https://github.com/nodejs/node/pull/18666
description: Runtime deprecation.
@ -2149,7 +2152,7 @@ changes:
description: Documentation-only deprecation.
-->
Type: Runtime
Type: End-of-Life
`process.assert()` is deprecated. Please use the [`assert`][] module instead.

View File

@ -67,10 +67,7 @@ const {
} = primordials;
const config = internalBinding('config');
const internalTimers = require('internal/timers');
const {
defineOperation,
deprecate,
} = require('internal/util');
const { defineOperation } = require('internal/util');
const {
validateInteger,
} = require('internal/validators');
@ -265,12 +262,6 @@ ObjectDefineProperty(process, 'allowedNodeEnvironmentFlags', {
configurable: true,
});
// process.assert
process.assert = deprecate(
perThreadSetup.assert,
'process.assert() is deprecated. Please use the `assert` module instead.',
'DEP0100');
// TODO(joyeecheung): this property has not been well-maintained, should we
// deprecate it in favor of a better API?
const { isDebugBuild, hasOpenSSL, hasInspector } = config;

View File

@ -33,7 +33,6 @@ const {
const {
ErrnoException,
codes: {
ERR_ASSERTION,
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
ERR_OUT_OF_RANGE,
@ -53,9 +52,6 @@ let getValidatedPath; // We need to lazy load it because of the circular depende
const kInternal = Symbol('internal properties');
function assert(x, msg) {
if (!x) throw new ERR_ASSERTION(msg || 'assertion error');
}
const { exitCodes: { kNoFailure } } = internalBinding('errors');
const binding = internalBinding('process_methods');
@ -428,7 +424,6 @@ const { arch, platform, version } = process;
module.exports = {
toggleTraceCategoryState,
assert,
buildAllowedFlags,
wrapProcessMethods,
hrtime,

View File

@ -1,25 +0,0 @@
'use strict';
const common = require('../common');
const assert = require('assert');
common.expectWarning(
'DeprecationWarning',
'process.assert() is deprecated. Please use the `assert` module instead.',
'DEP0100'
);
assert.strictEqual(process.assert(1, 'error'), undefined);
assert.throws(() => {
process.assert(undefined, 'errorMessage');
}, {
code: 'ERR_ASSERTION',
name: 'Error',
message: 'errorMessage'
});
assert.throws(() => {
process.assert(false);
}, {
code: 'ERR_ASSERTION',
name: 'Error',
message: 'assertion error'
});