summaryrefslogtreecommitdiff
path: root/lib/console.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2017-12-16 01:40:28 -0200
committerRuben Bridgewater <ruben@bridgewater.de>2017-12-26 10:46:27 +0100
commit15d880bcb62c628f1e7c3cc7baf659a63b312c7c (patch)
tree22d31adf9129d836fc1236eb8bc4b8979dc0239a /lib/console.js
parent9ca4ab13171f2148a986062ac564161a1f6e124f (diff)
downloadnode-new-15d880bcb62c628f1e7c3cc7baf659a63b312c7c.tar.gz
console: make .assert standard compliant
The standard does not throw and has no stack trace. See https://console.spec.whatwg.org/#assert PR-URL: https://github.com/nodejs/node/pull/17706 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'lib/console.js')
-rw-r--r--lib/console.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/console.js b/lib/console.js
index cbaef07404..b6fb3d88b1 100644
--- a/lib/console.js
+++ b/lib/console.js
@@ -194,7 +194,8 @@ Console.prototype.trace = function trace(...args) {
Console.prototype.assert = function assert(expression, ...args) {
if (!expression) {
- require('assert').ok(false, util.format.apply(null, args));
+ args[0] = `Assertion failed${args.length === 0 ? '' : `: ${args[0]}`}`;
+ this.warn(util.format.apply(null, args));
}
};