-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid deprecation warnings in node.js 10 because we have methods called inspect #577
Conversation
Nice that we get rid of a deprecation warning but what we've had to do just seems.. 😬 Just to understand, we're not allowed to have an |
Yeah, pretty much. If we have a method anywhere called It seems our only alternative is to rename our own |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better that we don't show the deprecation warning of course, but I wish we didn't have to do this. As discussed with @papandreou, it's good this is being cleaned up in node land but outputting a deprecation warning affects all places where it meant something else.
Would it be an option to not call inspect on objects? I this this behavior was introduced from the very first prototype of inspection in Unexpected. Maybe things have improved 😊 |
Sorry about closing the PR. That happens too often on the phone. |
Sorry, I don't understand the suggestion? It's the node repl (and |
@sunesimonsen, I'll interpret your silence as an approval ;) |
nodejs/node#15549 🙄
In node.js 10+ the custom inspection function for our promises works, but causes a deprecation warning to be logged:
Ditto for
Unexpected#inspect
:The fix is to provide the custom inspection function via a symbol exported as
require('util').inspect.custom
instead. But because we're also using theinspect
method name for other things in Unexpected, we're forced to provide the symbol method on all objects that have aninspect
method. This PR fixes that up so we provide both in node versions where the custom symbol exists.