Skip to content
Permalink
Browse files

fix missing TERM cases

  • Loading branch information...
Qix- committed Jun 30, 2017
1 parent 3fca615 commit caeb7d8dca24cc09ade47ea48f762693a4926ed6
Showing with 7 additions and 1 deletion.
  1. +1 −1 index.js
  2. +6 −0 test.js
@@ -5,7 +5,7 @@ const supportsColor = require('supports-color');

const template = require('./templates.js');

const isSimpleWindowsTerm = process.platform === 'win32' && !process.env.TERM.toLowerCase().startsWith('xterm');
const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm');

// `supportsColor.level` → `ansiStyles.color[name]` mapping
const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
@@ -133,6 +133,12 @@ describe('chalk on windows', () => {
delete require.cache[resolveFrom(__dirname, 'ansi-styles')];
});

it('should detect a simple term if TERM isn\'t set', () => {
delete process.env.TERM;
const chalkCtx = importFresh('.');
assert.equal(chalkCtx.blue('foo'), '\u001B[94mfoo\u001B[39m');
});

it('should replace blue foreground color in cmd.exe', () => {
process.env.TERM = 'dumb';
const chalkCtx = importFresh('.');

0 comments on commit caeb7d8

Please sign in to comment.
You can’t perform that action at this time.