From 0411600a679224e79edd82710e1f5c74558710be Mon Sep 17 00:00:00 2001 From: Jorik Tangelder Date: Wed, 6 Apr 2016 09:34:43 +0200 Subject: [PATCH] return plain string when an invalid clazz is given --- lib/report/common/defaults.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/report/common/defaults.js b/lib/report/common/defaults.js index fae736fe..a9851c32 100644 --- a/lib/report/common/defaults.js +++ b/lib/report/common/defaults.js @@ -24,12 +24,13 @@ module.exports = { colorize: function (str, clazz) { /* istanbul ignore if: untestable in batch mode */ - if (supportsColor) { - var colors = { - low: '31;1', - medium: '33;1', - high: '32;1' - }; + var colors = { + low: '31;1', + medium: '33;1', + high: '32;1' + }; + + if (supportsColor && colors[clazz]) { return '\u001b[' + colors[clazz] + 'm' + str + '\u001b[0m'; } return str;