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,10 +1,10 @@
|
|||
import test from 'ava';
|
||||
import chalk from '../source/index.js';
|
||||
import chalk, {Chalk} from '../source/index.js';
|
||||
|
||||
chalk.level = 1;
|
||||
|
||||
test('create an isolated context where colors can be disabled (by level)', t => {
|
||||
const instance = new chalk.Instance({level: 0});
|
||||
const instance = new Chalk({level: 0});
|
||||
t.is(instance.red('foo'), 'foo');
|
||||
t.is(chalk.red('foo'), '\u001B[31mfoo\u001B[39m');
|
||||
instance.level = 2;
|
||||
|
|
@ -14,11 +14,11 @@ test('create an isolated context where colors can be disabled (by level)', t =>
|
|||
test('the `level` option should be a number from 0 to 3', t => {
|
||||
/* eslint-disable no-new */
|
||||
t.throws(() => {
|
||||
new chalk.Instance({level: 10});
|
||||
new Chalk({level: 10});
|
||||
}, {message: /should be an integer from 0 to 3/});
|
||||
|
||||
t.throws(() => {
|
||||
new chalk.Instance({level: -1});
|
||||
new Chalk({level: -1});
|
||||
}, {message: /should be an integer from 0 to 3/});
|
||||
/* eslint-enable no-new */
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue