From 33c24802e75185544b28e41048268b242b488d86 Mon Sep 17 00:00:00 2001 From: RedYetiDev <38299977+RedYetiDev@users.noreply.github.com> Date: Fri, 20 Sep 2024 18:09:04 -0400 Subject: [PATCH] domain: eol deprecate `process.assert` --- doc/api/deprecations.md | 5 ++++- lib/internal/bootstrap/node.js | 6 ------ lib/internal/process/per_thread.js | 4 ---- test/parallel/test-process-assert.js | 25 ------------------------- 4 files changed, 4 insertions(+), 36 deletions(-) delete mode 100644 test/parallel/test-process-assert.js diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index f10265b9ddd98a7..b4bc818116d7bf4 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2142,6 +2142,9 @@ parameter. -Type: Runtime +Type: End-of-Life `process.assert()` is deprecated. Please use the [`assert`][] module instead. diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index f7a62364b6107ab..f575c44253671ea 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -265,12 +265,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; diff --git a/lib/internal/process/per_thread.js b/lib/internal/process/per_thread.js index 70dcca3e8f0d967..14cfb7538d484f7 100644 --- a/lib/internal/process/per_thread.js +++ b/lib/internal/process/per_thread.js @@ -53,9 +53,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 +425,6 @@ const { arch, platform, version } = process; module.exports = { toggleTraceCategoryState, - assert, buildAllowedFlags, wrapProcessMethods, hrtime, diff --git a/test/parallel/test-process-assert.js b/test/parallel/test-process-assert.js deleted file mode 100644 index 2f0c3fc9430ce06..000000000000000 --- a/test/parallel/test-process-assert.js +++ /dev/null @@ -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' -});