Blame SOURCES/test.js

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