summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBenjamin Zaslavsky <benjamin.zaslavsky@gmail.com>2017-11-20 17:12:20 +0100
committerTobias Nießen <tniessen@tnie.de>2017-12-04 00:07:57 +0100
commitc84710d062dfa4b39f0aa819a61c91d513ab5d1b (patch)
treec03e7a07c1fca1a12e01103679b53aaff3846dfd /test
parent254b5f04e7b309146cb8ade1d1fb0b804b964a51 (diff)
downloadnode-new-c84710d062dfa4b39f0aa819a61c91d513ab5d1b.tar.gz
console: make dirxml an alias for console.log
This method was previously exposed by V8 (since node 8.0.0) but not implemented in node. PR-URL: https://github.com/nodejs/node/pull/17152 Refs: https://github.com/nodejs/node/issues/17128 Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-console.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/parallel/test-console.js b/test/parallel/test-console.js
index 618caf6f25..c0ca672eba 100644
--- a/test/parallel/test-console.js
+++ b/test/parallel/test-console.js
@@ -103,6 +103,14 @@ console.dir(custom_inspect, { showHidden: false });
console.dir({ foo: { bar: { baz: true } } }, { depth: 0 });
console.dir({ foo: { bar: { baz: true } } }, { depth: 1 });
+// test console.dirxml()
+console.dirxml(custom_inspect, custom_inspect);
+console.dirxml(
+ { foo: { bar: { baz: true } } },
+ { foo: { bar: { quux: false } } },
+ { foo: { bar: { quux: true } } }
+);
+
// test console.trace()
console.trace('This is a %j %d', { formatted: 'trace' }, 10, 'foo');
@@ -171,6 +179,11 @@ assert.strictEqual(strings.shift(),
"{ foo: 'bar', inspect: [Function: inspect] }\n");
assert.ok(strings.shift().includes('foo: [Object]'));
assert.strictEqual(strings.shift().includes('baz'), false);
+assert.strictEqual(strings.shift(), 'inspect inspect\n');
+assert.ok(strings[0].includes('foo: { bar: { baz:'));
+assert.ok(strings[0].includes('quux'));
+assert.ok(strings.shift().includes('quux: true'));
+
assert.ok(/^label: \d+\.\d{3}ms$/.test(strings.shift().trim()));
assert.ok(/^__proto__: \d+\.\d{3}ms$/.test(strings.shift().trim()));
assert.ok(/^constructor: \d+\.\d{3}ms$/.test(strings.shift().trim()));