Custom inspection warning #21119
Copy link
Copy link
Closed
Description
Version: 10.3.0
Platform: OS-x
Subsystem: –
Something is broken about deprecation warning on .inspect. Honestly, I never heard of this method (Node's magic stuff?) But at this moment all libraries having objects with inspect method in their APIs are affected.
> {inspect: () => null}
null
> (node:1278) [DEP0079] DeprecationWarning: Custom inspection function on Objects via .inspect() is deprecated
One example of such library: https://github.com/origamitower/folktale
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
jdalton commentedon Jun 5, 2018
Hi @ivan-kleshnin!
This is because in Node 6.6.0 a symbol
util.inspect.customwas added and the old behavior of using a method namedinspectwas deprecated. For more info on custom inspection see this. Eventually, the documentation deprecation became a runtime deprecation. You're seeing this in the REPL because under the hood the REPL usesutil.inspect().The deprecation and legacy functionality will be removed in Node 11 (#20722)
It does seem odd that the REPL use should trigger the deprecation warning since it's a side-effect of the REPL implementation. The simplest way to handle this in core would be with
process.noDeprecation=truebefore theutil.inspect()call and reset after.For user-land a temporary workaround could be to add a non-function value of the
util.inspect.customsymbolivan-kleshnin commentedon Jun 5, 2018
Ok, got it. Thank your for the explanation! Closing...