Skip to content

Commit 13a7539

Browse files
author
Ethan Arrowood
committed
doc: add --disable-warnings option to docs
1 parent a6baf63 commit 13a7539

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

doc/api/cli.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,48 @@ Affects the default output directory of:
443443
* [`--heap-prof-dir`][]
444444
* [`--redirect-warnings`][]
445445

446+
### `--disable-warnings=code-or-type`
447+
448+
<!-- YAML
449+
added: REPLACEME
450+
-->
451+
452+
Disable specific process warnings by `code` or `type`.
453+
454+
Warnings emitted from [`process.emitWarning()`][emit_warning] may contain a
455+
`code` and a `type`. This option will not-emit warnings that have a matching
456+
`code` or `type`.
457+
458+
List of [deprecation warnings][].
459+
460+
The Node.js core warning types are: `DeprecationWarning` and
461+
`ExperimentalWarning`
462+
463+
For example, the following script will not emit
464+
[DEP0025 `require('node:sys')`][DEP0025 warning] when executed with
465+
`node --disable-warnings=DEP0025`:
466+
467+
```js
468+
'use strict';
469+
470+
const sys = require('sys'); // eslint-disable-line no-restricted-modules
471+
```
472+
473+
For example, the following script will emit the
474+
[DEP0025 `require('node:sys')`][DEP0025 warning], but not any Experimental
475+
Warnings (such as
476+
[ExperimentalWarning: `vm.measureMemory` is an experimental feature][]
477+
in <=v21) when executed with `node --disable-warnings=ExperimentalWarnings`:
478+
479+
```js
480+
'use strict';
481+
482+
const sys = require('sys'); // eslint-disable-line no-restricted-modules
483+
const vm = require('vm');
484+
485+
vm.measureMemory();
486+
```
487+
446488
### `--disable-proto=mode`
447489

448490
<!-- YAML
@@ -2126,6 +2168,14 @@ added: v0.1.3
21262168

21272169
Print node's version.
21282170

2171+
### `--warnings`
2172+
2173+
<!-- YAML
2174+
added: v6.0.0
2175+
-->
2176+
2177+
Emit all process warnings (including deprecations). Enabled by default. See [`--no-warnings`][] to disable all process warnings.
2178+
21292179
### `--watch`
21302180

21312181
<!-- YAML
@@ -2327,6 +2377,7 @@ Node.js options that are allowed are:
23272377
* `--conditions`, `-C`
23282378
* `--diagnostic-dir`
23292379
* `--disable-proto`
2380+
* `--disable-warnings`
23302381
* `--dns-result-order`
23312382
* `--enable-fips`
23322383
* `--enable-network-family-autoselection`
@@ -2429,6 +2480,7 @@ Node.js options that are allowed are:
24292480
* `--use-largepages`
24302481
* `--use-openssl-ca`
24312482
* `--v8-pool-size`
2483+
* `--warnings`
24322484
* `--watch-path`
24332485
* `--watch-preserve-output`
24342486
* `--watch`
@@ -2779,7 +2831,9 @@ done
27792831
[CommonJS]: modules.md
27802832
[CommonJS module]: modules.md
27812833
[CustomEvent Web API]: https://dom.spec.whatwg.org/#customevent
2834+
[DEP0025 warning]: deprecations.md#DEP0025
27822835
[ECMAScript module]: esm.md#modules-ecmascript-modules
2836+
[ExperimentalWarning: `vm.measureMemory` is an experimental feature]: vm.md#vmmeasurememoryoptions
27832837
[Fetch API]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
27842838
[File System Permissions]: permissions.md#file-system-permissions
27852839
[Module customization hooks]: module.md#customization-hooks
@@ -2808,6 +2862,7 @@ done
28082862
[`--experimental-wasm-modules`]: #--experimental-wasm-modules
28092863
[`--heap-prof-dir`]: #--heap-prof-dir
28102864
[`--import`]: #--importmodule
2865+
[`--no-warnings`]: #--no-warnings
28112866
[`--openssl-config`]: #--openssl-configfile
28122867
[`--preserve-symlinks`]: #--preserve-symlinks
28132868
[`--redirect-warnings`]: #--redirect-warningsfile
@@ -2835,6 +2890,7 @@ done
28352890
[context-aware]: addons.md#context-aware-addons
28362891
[debugger]: debugger.md
28372892
[debugging security implications]: https://nodejs.org/en/docs/guides/debugging-getting-started/#security-implications
2893+
[deprecation warnings]: deprecations.md#list-of-deprecated-apis
28382894
[emit_warning]: process.md#processemitwarningwarning-options
28392895
[environment_variables]: #environment-variables
28402896
[filtering tests by name]: test.md#filtering-tests-by-name

0 commit comments

Comments
 (0)