diff --git a/lib/internal/url.js b/lib/internal/url.js index c976e950076eaf..9ab469c9ffa570 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -77,7 +77,7 @@ class TupleOrigin { return result; } - inspect() { + [util.inspect.custom]() { return `TupleOrigin { scheme: ${this[kScheme]}, host: ${this[kHost]}, @@ -235,7 +235,7 @@ class URL { return (this[context].flags & binding.URL_FLAGS_CANNOT_BE_BASE) !== 0; } - inspect(depth, opts) { + [util.inspect.custom](depth, opts) { const ctx = this[context]; var ret = 'URL {\n'; ret += ` href: ${this.href}\n`; diff --git a/test/parallel/test-whatwg-url-parsing.js b/test/parallel/test-whatwg-url-parsing.js index 9ea6cc74bff5e6..f1fd2ae9051533 100644 --- a/test/parallel/test-whatwg-url-parsing.js +++ b/test/parallel/test-whatwg-url-parsing.js @@ -1,6 +1,7 @@ 'use strict'; const common = require('../common'); +const util = require('util'); if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. @@ -144,8 +145,8 @@ for (const test of allTests) { const url = test.url ? new URL(test.url) : new URL(test.input, test.base); for (const showHidden of [true, false]) { - const res = url.inspect(null, { - showHidden: showHidden + const res = util.inspect(url, { + showHidden }); const lines = res.split('\n');