style(stderr): use chalkStderr instead of cherr

This commit is contained in:
Pavel Lang 2018-12-28 04:12:58 +01:00
parent 5fd274a799
commit f29eaaec43
No known key found for this signature in database
GPG key ID: 623A223A57974B55
4 changed files with 23 additions and 23 deletions

View file

@ -1,6 +1,6 @@
'use strict';
const chalk = require('..');
const cherr = require('../stderr');
const chalkStderr = require('../stderr');
console.log(chalk.hex('#ff6159')('test'));
console.error(cherr.hex('#ffe861')('test stderr'));
console.error(chalkStderr.hex('#ffe861')('test stderr'));

View file

@ -1,6 +1,6 @@
// @flow
import chalk from '..';
import cherr from '../stderr';
import chalkStderr from '../stderr';
// $ExpectError (Can't have typo in option name)
chalk.constructor({levl: 1});
@ -15,8 +15,8 @@ chalk.underline(null);
chalk.underline('foo');
// $ExpectError (Can't pass in null)
cherr.underline(null);
cherr.underline('foo');
chalkStderr.underline(null);
chalkStderr.underline('foo');
// $ExpectError (Can't have typo in chalk method)
chalk.rd('foo');

View file

@ -5,21 +5,21 @@ import execa from 'execa';
// Spoof supports-color
require('./_supports-color')(__dirname);
const cherr = require('../stderr');
const chalkStderr = require('../stderr');
test('stderr don\'t output colors when manually disabled', t => {
cherr.enabled = false;
t.is(cherr.red('foo'), 'foo');
cherr.enabled = true;
chalkStderr.enabled = false;
t.is(chalkStderr.red('foo'), 'foo');
chalkStderr.enabled = true;
});
test('stderr enable/disable colors based on overall chalk enabled property, not individual instances', t => {
cherr.enabled = false;
const {red} = cherr;
chalkStderr.enabled = false;
const {red} = chalkStderr;
t.false(red.enabled);
cherr.enabled = true;
chalkStderr.enabled = true;
t.true(red.enabled);
cherr.enabled = true;
chalkStderr.enabled = true;
});
test('disable colors if they are not supported', async t => {