forked from orbit-oss/chalk
Add named exports (#432)
This commit is contained in:
parent
fa16f4ec37
commit
d798222a5a
10 changed files with 147 additions and 165 deletions
|
|
@ -1,22 +1,22 @@
|
|||
import test from 'ava';
|
||||
import chalk from '../source/index.js';
|
||||
import chalk, {Chalk} from '../source/index.js';
|
||||
|
||||
chalk.level = 1;
|
||||
|
||||
test('visible: normal output when level > 0', t => {
|
||||
const instance = new chalk.Instance({level: 3});
|
||||
const instance = new Chalk({level: 3});
|
||||
t.is(instance.visible.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
t.is(instance.red.visible('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
});
|
||||
|
||||
test('visible: no output when level is too low', t => {
|
||||
const instance = new chalk.Instance({level: 0});
|
||||
const instance = new Chalk({level: 0});
|
||||
t.is(instance.visible.red('foo'), '');
|
||||
t.is(instance.red.visible('foo'), '');
|
||||
});
|
||||
|
||||
test('test switching back and forth between level == 0 and level > 0', t => {
|
||||
const instance = new chalk.Instance({level: 3});
|
||||
const instance = new Chalk({level: 3});
|
||||
t.is(instance.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
t.is(instance.visible.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
t.is(instance.red.visible('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue