From bff790d774d5f2f5973ba7818ccaf108aa5ff4ca Mon Sep 17 00:00:00 2001 From: Vlad Stirbu Date: Wed, 25 Oct 2017 23:48:26 +0300 Subject: [PATCH] removed uneeded condition --- README.md | 5 +++-- lib/index.js | 12 ++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e5e67f2..af23c56 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # chai-as-typed -[![Greenkeeper badge](https://badges.greenkeeper.io/vstirbu/chai-as-typed.svg)](https://greenkeeper.io/) - [![Build Status](https://travis-ci.org/vstirbu/chai-as-typed.svg?branch=master)](https://travis-ci.org/vstirbu/chai-as-typed) [![Coverage Status](https://coveralls.io/repos/github/vstirbu/chai-as-typed/badge.svg?branch=master)](https://coveralls.io/github/vstirbu/chai-as-typed?branch=master) +[![Greenkeeper badge](https://badges.greenkeeper.io/vstirbu/chai-as-typed.svg)](https://greenkeeper.io/) + +## Motivation diff --git a/lib/index.js b/lib/index.js index 95f01a3..26cab79 100644 --- a/lib/index.js +++ b/lib/index.js @@ -9,14 +9,10 @@ const options = { }; const prettifyDiagnostic = diagnostic => { - if (diagnostic.file) { - const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); - const messageText = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); - - return `${diagnostic.file.fileName} (Ln ${line + 1}, Col ${character + 1}): ${messageText}` - } else { - console.log(`${ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n')}`); - } + const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + const messageText = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); + + return `${diagnostic.file.fileName} (Ln ${line + 1}, Col ${character + 1}): ${messageText}` } module.exports = (chai, utils) => {