Skip to content

Commit

Permalink
Color fix (#3607)
Browse files Browse the repository at this point in the history
* Added reset to unbold for simple windows console.

* Reset chalk for test consistency.
  • Loading branch information
viceice authored and arcanis committed Jun 14, 2017
1 parent a720285 commit 0361edf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions __tests__/reporters/console-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const stream = require('stream');
require('chalk').enabled = true;
require('chalk').supportsColor = true;
require('chalk').styles.blue.open = '\u001b[34m';
require('chalk').styles.bold.close = '\u001b[22m';

test('ConsoleReporter.step', async () => {
expect(
Expand Down
5 changes: 5 additions & 0 deletions src/reporters/console/console-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ const tty = require('tty');
type Row = Array<string>;
type InquirerResponses<K, T> = {[key: K]: Array<T>};

// fixes bold on windows
if (process.platform === 'win32' && process.env.TERM && !/^xterm/i.test(process.env.TERM)) {
chalk.styles.bold.close += '\u001b[m';
}

export default class ConsoleReporter extends BaseReporter {
constructor(opts: Object) {
super(opts);
Expand Down

0 comments on commit 0361edf

Please sign in to comment.