From b3798dfd77adbcb0a3ab05579a0d277d7178776f Mon Sep 17 00:00:00 2001 From: Chris Chua Date: Sun, 20 Sep 2015 17:18:16 -0700 Subject: [PATCH] fix(reporter): preserve base/absolute word in error Previously, any error log message containing the words `absolute` or `base` would have those words munged by the error formatter. --- lib/reporter.js | 3 ++- test/unit/reporter.spec.js | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/reporter.js b/lib/reporter.js index 7cbf9fdc7..57f241bb1 100644 --- a/lib/reporter.js +++ b/lib/reporter.js @@ -65,7 +65,8 @@ var createErrorFormatter = function (basePath, emitter, SourceMapConsumer) { } } - return path + (line ? ':' + line : '') + (column ? ':' + column : '') + var result = path + (line ? ':' + line : '') + (column ? ':' + column : '') + return result || prefix }) // indent every line diff --git a/test/unit/reporter.spec.js b/test/unit/reporter.spec.js index 539468545..d946d78a7 100644 --- a/test/unit/reporter.spec.js +++ b/test/unit/reporter.spec.js @@ -64,6 +64,16 @@ describe('reporter', () => { expect(formatError(ERROR)).to.equal('at /usr/path.js:2\n') }) + it('should preserve absolute word', () => { + var ERROR = 'contains absolute' + expect(formatError(ERROR)).to.equal('contains absolute\n') + }) + + it('should preserve base word', () => { + var ERROR = 'contains base' + expect(formatError(ERROR)).to.equal('contains base\n') + }) + describe('source maps', () => { class MockSourceMapConsumer { constructor (sourceMap) {