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) {