Move testing to ava (#182)
This commit is contained in:
parent
e8d28f3041
commit
4c4eb1fd0a
10 changed files with 371 additions and 356 deletions
22
test/constructor.js
Normal file
22
test/constructor.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import test from 'ava';
|
||||
|
||||
// Spoof supports-color
|
||||
require('./_supports-color')(__dirname);
|
||||
|
||||
const m = 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');
|
||||
});
|
||||
|
||||
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');
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue