From 5758161001802a42dc3178b8746cdc5ed58df424 Mon Sep 17 00:00:00 2001 From: Eran Hammer Date: Sat, 31 Oct 2015 09:52:03 -0700 Subject: [PATCH] Lint errors. Closes #168 --- lib/index.js | 3 ++- test/index.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 36813153..96d56c91 100755 --- a/lib/index.js +++ b/lib/index.js @@ -723,10 +723,11 @@ exports.assert = function (condition /*, msg1, msg2, msg3 */) { } } - msgs = msgs.map(function (msg) { + msgs = msgs.map((msg) => { return typeof msg === 'string' ? msg : msg instanceof Error ? msg.message : exports.stringify(msg); }); + throw new Error(msgs.join(' ') || 'Unknown error'); }; diff --git a/test/index.js b/test/index.js index bbfa6bfe..57be48ec 100755 --- a/test/index.js +++ b/test/index.js @@ -1853,7 +1853,8 @@ describe('assert()', () => { try { fn(); - } catch (err) { + } + catch (err) { expect(error).to.equal(error); // should be the same reference expect(error).to.not.equal(error2); // error with the same message should not match }