-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Description
Affected URL(s)
From https://nodejs.org/docs/latest/api/process.html
To https://nodejs.org/docs/latest-v6.x/api/process.html
Description of the problem
I wanted to set --trace-warnings programmaticaly at runtime from within node.
I noticed:
node/lib/internal/process/warning.js
Lines 114 to 115 in 67c19c2
| const trace = process.traceProcessWarnings || | |
| (isDeprecation && process.traceDeprecation); |
So I can use process.traceProcessWarnings = true at runtime to toggle stack trace on warnings.
Important
However in the documentation, from version 6.X LTS to latest 22.X, this field process.traceProcessWarnings is never documented but the field process.traceDeprecation is documented (https://nodejs.org/docs/latest/api/process.html#processtracedeprecation).
Btw, the documentation for the fields process.traceDeprecation, process.noDeprecation could mention that they are mutable, just like process.throwDeprecation does since 12.X LTS:
process.throwDeprecationis mutable, so whether or not deprecation warnings result in errors may be altered at runtime.
https://nodejs.org/docs/latest-v12.x/api/process.html#process_process_throwdeprecation
By #29495
It could be nice to document that.
Note
Also I noticed the process.noProcessWarnings does not work like process.noDeprecation:
it won't change the behavior if assigned at runtime. For this case, using the --no-warnings is the only option.
And I don't know why as this is not documented
Should I make a PR to add documentation