Require Node.js 6
This commit is contained in:
parent
70f22d87ba
commit
0307f263cb
13 changed files with 204 additions and 216 deletions
|
|
@ -3,20 +3,20 @@ import test from 'ava';
|
|||
// Spoof supports-color
|
||||
require('./_supports-color')(__dirname);
|
||||
|
||||
const m = require('..');
|
||||
const chalk = require('..');
|
||||
|
||||
test('create an isolated context where colors can be disabled (by level)', t => {
|
||||
const ctx = new m.constructor({level: 0, enabled: true});
|
||||
t.is(ctx.red('foo'), 'foo');
|
||||
t.is(m.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
ctx.level = 2;
|
||||
t.is(ctx.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
const instance = new chalk.constructor({level: 0, enabled: true});
|
||||
t.is(instance.red('foo'), 'foo');
|
||||
t.is(chalk.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
instance.level = 2;
|
||||
t.is(instance.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
});
|
||||
|
||||
test('create an isolated context where colors can be disabled (by enabled flag)', t => {
|
||||
const ctx = new m.constructor({enabled: false});
|
||||
t.is(ctx.red('foo'), 'foo');
|
||||
t.is(m.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
ctx.enabled = true;
|
||||
t.is(ctx.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
const instance = new chalk.constructor({enabled: false});
|
||||
t.is(instance.red('foo'), 'foo');
|
||||
t.is(chalk.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
instance.enabled = true;
|
||||
t.is(instance.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue