Skip to content

Commit

Permalink
doc: add --disable-warnings option to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethan Arrowood committed Nov 10, 2023
1 parent a6baf63 commit 13a7539
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,48 @@ Affects the default output directory of:
* [`--heap-prof-dir`][]
* [`--redirect-warnings`][]

### `--disable-warnings=code-or-type`

<!-- YAML
added: REPLACEME
-->

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`

<!-- YAML
Expand Down Expand Up @@ -2126,6 +2168,14 @@ added: v0.1.3

Print node's version.

### `--warnings`

<!-- YAML
added: v6.0.0
-->

Emit all process warnings (including deprecations). Enabled by default. See [`--no-warnings`][] to disable all process warnings.

### `--watch`

<!-- YAML
Expand Down Expand Up @@ -2327,6 +2377,7 @@ Node.js options that are allowed are:
* `--conditions`, `-C`
* `--diagnostic-dir`
* `--disable-proto`
* `--disable-warnings`
* `--dns-result-order`
* `--enable-fips`
* `--enable-network-family-autoselection`
Expand Down Expand Up @@ -2429,6 +2480,7 @@ Node.js options that are allowed are:
* `--use-largepages`
* `--use-openssl-ca`
* `--v8-pool-size`
* `--warnings`
* `--watch-path`
* `--watch-preserve-output`
* `--watch`
Expand Down Expand Up @@ -2779,7 +2831,9 @@ done
[CommonJS]: modules.md
[CommonJS module]: modules.md
[CustomEvent Web API]: https://dom.spec.whatwg.org/#customevent
[DEP0025 warning]: deprecations.md#DEP0025
[ECMAScript module]: esm.md#modules-ecmascript-modules
[ExperimentalWarning: `vm.measureMemory` is an experimental feature]: vm.md#vmmeasurememoryoptions
[Fetch API]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
[File System Permissions]: permissions.md#file-system-permissions
[Module customization hooks]: module.md#customization-hooks
Expand Down Expand Up @@ -2808,6 +2862,7 @@ done
[`--experimental-wasm-modules`]: #--experimental-wasm-modules
[`--heap-prof-dir`]: #--heap-prof-dir
[`--import`]: #--importmodule
[`--no-warnings`]: #--no-warnings
[`--openssl-config`]: #--openssl-configfile
[`--preserve-symlinks`]: #--preserve-symlinks
[`--redirect-warnings`]: #--redirect-warningsfile
Expand Down Expand Up @@ -2835,6 +2890,7 @@ done
[context-aware]: addons.md#context-aware-addons
[debugger]: debugger.md
[debugging security implications]: https://nodejs.org/en/docs/guides/debugging-getting-started/#security-implications
[deprecation warnings]: deprecations.md#list-of-deprecated-apis
[emit_warning]: process.md#processemitwarningwarning-options
[environment_variables]: #environment-variables
[filtering tests by name]: test.md#filtering-tests-by-name
Expand Down

0 comments on commit 13a7539

Please sign in to comment.