Skip to content

Commit

Permalink
Merge 9018edf into a8c60e3
Browse files Browse the repository at this point in the history
  • Loading branch information
nazrhyn committed Dec 15, 2017
2 parents a8c60e3 + 9018edf commit e545648
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
5 changes: 3 additions & 2 deletions .gitignore
@@ -1,4 +1,5 @@
node_modules
.idea/
node_modules/
coverage/
yarn.lock
coverage
.nyc_output
18 changes: 9 additions & 9 deletions test/_supports-color.js
@@ -1,13 +1,13 @@
'use strict';
const resolveFrom = require('resolve-from');

module.exports = dir => {
require.cache[resolveFrom(dir, 'supports-color')] = {
exports: {
level: 3,
hasBasic: true,
has256: true,
has16m: true
}
};
const DEFAULT = {
level: 3,
hasBasic: true,
has256: true,
has16m: true
};

module.exports = (dir, override) => {
require.cache[resolveFrom(dir, 'supports-color')] = {exports: override || DEFAULT};
};
16 changes: 16 additions & 0 deletions test/no-color-support.js
@@ -0,0 +1,16 @@
import test from 'ava';

// Spoof supports-color
require('./_supports-color')(__dirname, {
level: 0,
hasBasic: false,
has256: false,
has16m: false
});

const m = require('..');

test.failing('can be forced on using chalk.enabled', t => {
m.enabled = true;
t.is(m.green('hello'), '\u001b[32mhello\u001b[39m');
});

0 comments on commit e545648

Please sign in to comment.