Blame SOURCES/test.js

f585a3
'use strict';
f585a3
var assert = require('assert');
f585a3
f585a3
beforeEach(function () {
f585a3
	// clear the cache of the tested module
f585a3
	delete require.cache[require.resolve('./index')];
f585a3
	process.stdout.isTTY = true;
f585a3
	process.argv = [];
f585a3
	process.env = {};
f585a3
});
f585a3
f585a3
it('should return false if not TTY', function () {
f585a3
	process.stdout.isTTY = false;
f585a3
	assert.equal(require('./index'), false);
f585a3
});
f585a3
f585a3
it('should return false if --no-color flag is used', function () {
f585a3
	process.argv = ['--no-color'];
f585a3
	assert.equal(require('./index'), false);
f585a3
});
f585a3
f585a3
it('should return true if --color flag is used', function () {
f585a3
	process.argv = ['--color'];
f585a3
	assert.equal(require('./index'), true);
f585a3
});
f585a3
f585a3
it('should return true if `COLORTERM` is in env', function () {
f585a3
	process.env.COLORTERM = true;
f585a3
	assert.equal(require('./index'), true);
f585a3
});
f585a3