Skip to content

Commit 0361edf

Browse files
viceicearcanis
authored andcommitted
Color fix (#3607)
* Added reset to unbold for simple windows console. * Reset chalk for test consistency.
1 parent a720285 commit 0361edf

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

__tests__/reporters/console-reporter.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const stream = require('stream');
1313
require('chalk').enabled = true;
1414
require('chalk').supportsColor = true;
1515
require('chalk').styles.blue.open = '\u001b[34m';
16+
require('chalk').styles.bold.close = '\u001b[22m';
1617

1718
test('ConsoleReporter.step', async () => {
1819
expect(

src/reporters/console/console-reporter.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ const tty = require('tty');
2727
type Row = Array<string>;
2828
type InquirerResponses<K, T> = {[key: K]: Array<T>};
2929

30+
// fixes bold on windows
31+
if (process.platform === 'win32' && process.env.TERM && !/^xterm/i.test(process.env.TERM)) {
32+
chalk.styles.bold.close += '\u001b[m';
33+
}
34+
3035
export default class ConsoleReporter extends BaseReporter {
3136
constructor(opts: Object) {
3237
super(opts);

0 commit comments

Comments
 (0)