Blame SOURCES/test.js

7fba3c
'use strict';
7fba3c
var assert = require('assert');
7fba3c
var exec = require('child_process').exec;
7fba3c
var strip = require('./index');
7fba3c
7fba3c
it('should strip color from string', function () {
7fba3c
	assert.equal(strip('\x1b[0m\x1b[4m\x1b[42m\x1b[31mfoo\x1b[39m\x1b[49m\x1b[24mfoo\x1b[0m'), 'foofoo');
7fba3c
});
7fba3c
7fba3c
it('should strip reset;setfg;setbg;italics;strike;underline sequence from string', function () {
7fba3c
	assert.equal(strip('\x1b[0;33;49;3;9;4mbar\x1b[0m'), 'bar');
7fba3c
});
7fba3c
7fba3c
it('should strip color with CLI', function (done) {
7fba3c
	exec('echo "\x1b[0m\x1b[4m\x1b[42m\x1b[31mfoo\x1b[39m\x1b[49m\x1b[24mfoo\x1b[0m" | ./cli.js', function (err, stdout) {
7fba3c
		assert.equal(stdout, 'foofoo\n');
7fba3c
		done();
7fba3c
	});
7fba3c
});