diff --git a/doc/api/cli.md b/doc/api/cli.md index 1f5136ce69442f..f3de247afd19af 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -443,6 +443,48 @@ Affects the default output directory of: * [`--heap-prof-dir`][] * [`--redirect-warnings`][] +### `--disable-warnings=code-or-type` + + + +Disable specific process warnings by `code` or `type`. + +Warnings emitted from [`process.emitWarning()`][emit_warning] may contain a +`code` and a `type`. This option will not-emit warnings that have a matching +`code` or `type`. + +List of [deprecation warnings][]. + +The Node.js core warning types are: `DeprecationWarning` and +`ExperimentalWarning` + +For example, the following script will not emit +[DEP0025 `require('node:sys')`][DEP0025 warning] when executed with +`node --disable-warnings=DEP0025`: + +```js +'use strict'; + +const sys = require('sys'); // eslint-disable-line no-restricted-modules +``` + +For example, the following script will emit the +[DEP0025 `require('node:sys')`][DEP0025 warning], but not any Experimental +Warnings (such as +[ExperimentalWarning: `vm.measureMemory` is an experimental feature][] +in <=v21) when executed with `node --disable-warnings=ExperimentalWarnings`: + +```js +'use strict'; + +const sys = require('sys'); // eslint-disable-line no-restricted-modules +const vm = require('vm'); + +vm.measureMemory(); +``` + ### `--disable-proto=mode`