From a7b2c78b8d4372dca950d055e9079c8b0e4771f8 Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Thu, 26 May 2016 21:13:21 +0200 Subject: [PATCH] Better smart colorize --- lib/Default.coffee | 2 +- test/test.coffee | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Default.coffee b/lib/Default.coffee index 0eba7bc..9f93b29 100644 --- a/lib/Default.coffee +++ b/lib/Default.coffee @@ -93,8 +93,8 @@ module.exports = colorizeMessage: (type, message) -> return stripAnsi message unless @color - lineColor = CONST.LINE_COLOR + return @colorize lineColor, message if message.indexOf '=' is -1 typeColor = @types[type].color message.toString().split(' ').map((msg) => diff --git a/test/test.coffee b/test/test.coffee index 4dcafbf..6106334 100755 --- a/test/test.coffee +++ b/test/test.coffee @@ -31,7 +31,7 @@ describe 'Acho ::', -> instance.print() instance.transport.store.length.should.be.equal 1 - expected = ' \u001b[34minfo\u001b[39m \u001b[90minfo\u001b[39m \u001b[90mmessage\u001b[39m' + expected = ' \u001b[34minfo\u001b[39m \u001b[90minfo message\u001b[39m' instance.transport.store[0].should.be.equal expected it '.push: add message into a internal level collection', -> @@ -44,7 +44,7 @@ describe 'Acho ::', -> @acho.transport.store.length.should.be.equal 1 @acho.messages.error.length.should.be.equal 1 - expected = '\u001b[31m[error] » \u001b[39m \u001b[90mhello\u001b[39m \u001b[90mworld\u001b[39m' + expected = '\u001b[31m[error] » \u001b[39m \u001b[90mhello world\u001b[39m' @acho.transport.store[0].should.be.equal expected @acho.messages.error[0].should.be.equal 'hello world' @@ -54,7 +54,7 @@ describe 'Acho ::', -> @acho.warn 'warn message' @acho.transport.store.length.should.be.equal 1 - expected = ' \u001b[33m[warn] » \u001b[39m \u001b[90mwarn\u001b[39m \u001b[90mmessage\u001b[39m' + expected = ' \u001b[33m[warn] » \u001b[39m \u001b[90mwarn message\u001b[39m' @acho.transport.store[0].should.be.equal expected it 'change the color behavior', -> @@ -63,7 +63,7 @@ describe 'Acho ::', -> @acho.print() @acho.transport.store.length.should.be.equal 1 - expected = '\u001b[31m\u001b[1m[error] » \u001b[22m\u001b[39m \u001b[90mhello\u001b[39m \u001b[90mworld\u001b[39m' + expected = '\u001b[31m\u001b[1m[error] » \u001b[22m\u001b[39m \u001b[90mhello world\u001b[39m' @acho.transport.store[0].should.be.equal expected it 'no ouptut messages out of the level', ->