The wrapper marks the unprintable characters from each style tag. This is very useful when debugging or outputing it in different terminals. You can use it to identify the unprintable characters or even to escape them. Also added tests for it. Added a description about it to the readme dile. wq
25 lines
506 B
JavaScript
25 lines
506 B
JavaScript
// Import path from 'path';
|
|
import test from 'ava';
|
|
// Import execa from 'execa';
|
|
|
|
// Spoof supports-color
|
|
require('./_supports-color')(__dirname);
|
|
|
|
const m = require('..');
|
|
|
|
m.wrapper = {
|
|
pre: '@',
|
|
post: '#'
|
|
};
|
|
|
|
test('add wrapper to underline', t => {
|
|
t.is(m.underline('foo'), '@\u001B[4m#foo@\u001B[24m#');
|
|
});
|
|
|
|
test('add wrapper to color', t => {
|
|
t.is(m.red('foo'), '@\u001B[31m#foo@\u001B[39m#');
|
|
});
|
|
|
|
test('add wrapper to bgColor', t => {
|
|
t.is(m.bgRed('foo'), '@\u001B[41m#foo@\u001B[49m#');
|
|
});
|