test(stderr): test if stderr work
This commit is contained in:
parent
85f99bb677
commit
6be301b1a4
3 changed files with 35 additions and 0 deletions
27
test/stderr.js
Normal file
27
test/stderr.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import path from 'path';
|
||||
import test from 'ava';
|
||||
import execa from 'execa';
|
||||
|
||||
// Spoof supports-color
|
||||
require('./_supports-color')(__dirname);
|
||||
|
||||
const cherr = require('../stderr');
|
||||
|
||||
test('stderr don\'t output colors when manually disabled', t => {
|
||||
cherr.enabled = false;
|
||||
t.is(cherr.red('foo'), 'foo');
|
||||
cherr.enabled = true;
|
||||
});
|
||||
|
||||
test('stderr enable/disable colors based on overall chalk enabled property, not individual instances', t => {
|
||||
cherr.enabled = false;
|
||||
const {red} = cherr;
|
||||
t.false(red.enabled);
|
||||
cherr.enabled = true;
|
||||
t.true(red.enabled);
|
||||
cherr.enabled = true;
|
||||
});
|
||||
|
||||
test('disable colors if they are not supported', async t => {
|
||||
t.is(await execa.stderr('node', [path.join(__dirname, '_fixture')]), 'test stderr');
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue