-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ var diff = require('diff'); | |
var ms = require('../ms'); | ||
var utils = require('../utils'); | ||
var supportsColor = process.browser ? null : require('supports-color'); | ||
var chalk = require('chalk'); | ||
chalk.enabled = supportsColor; | ||
|
||
/** | ||
* Expose `Base`. | ||
|
@@ -50,25 +52,25 @@ exports.inlineDiffs = false; | |
*/ | ||
|
||
exports.colors = { | ||
pass: 90, | ||
fail: 31, | ||
'bright pass': 92, | ||
'bright fail': 91, | ||
'bright yellow': 93, | ||
pending: 36, | ||
suite: 0, | ||
'error title': 0, | ||
'error message': 31, | ||
'error stack': 90, | ||
checkmark: 32, | ||
fast: 90, | ||
medium: 33, | ||
slow: 31, | ||
green: 32, | ||
light: 90, | ||
'diff gutter': 90, | ||
'diff added': 32, | ||
'diff removed': 31 | ||
pass: chalk.gray, | ||
fail: chalk.red, | ||
'bright pass': chalk.green.bold, | ||
'bright fail': chalk.red.bold, | ||
'bright yellow': chalk.yellow.bold, | ||
pending: chalk.cyan, | ||
suite: chalk.white, | ||
'error title': chalk.gray, | ||
'error message': chalk.red, | ||
'error stack': chalk.white, | ||
checkmark: chalk.green, | ||
fast: chalk.gray, | ||
medium: chalk.yellow, | ||
slow: chalk.red, | ||
green: chalk.green, | ||
light: chalk.white.bold, | ||
'diff gutter': chalk.gray, | ||
'diff added': chalk.green, | ||
'diff removed': chalk.red | ||
}; | ||
|
||
/** | ||
|
@@ -103,7 +105,7 @@ var color = exports.color = function(type, str) { | |
if (!exports.useColors) { | ||
return String(str); | ||
} | ||
return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m'; | ||
return '\u001b[' + exports.colors[type](str) + '\u001b[0m'; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
octref
|
||
}; | ||
|
||
/** | ||
|
7 comments
on commit 1192914
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chalk update breaks colors in terminal in 2.4.1 works fine in 2.3.4. It does not show the colors only shows the color codes [[1m
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can confirm it works locally for me as well. @mrjoelkemp as Daniel asked, what shell + OS + terminal emulator are you using?
I'm double interested, as I've helped develop Chalk ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am using Z shell through Webstorm. Another person having same error is running Cmder with Powershell
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrjoelkemp could you confirm that your shell supports color codes by placing, e.g.:
console.log("\033[31m Hello World")
somewhere in your test, and confirming the printed string is red?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in Strict mode that throws but I tested it in non strict and it works fine in red:
I fixed the issue in a pull request: #2072
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I had missed the PR, thanks for creating one. Let's continue the discussion there.
If I remember correctly, you don't need the beginning
\u001b[
if you are using chalk, or do you?