Skip to content

Commit

Permalink
Fix level when supportsColor returns falsey (fixes #176, #175)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qix- committed Aug 7, 2017
1 parent fbd17e7 commit 0827d3b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion index.js
Expand Up @@ -19,7 +19,8 @@ function applyOptions(obj, options) {
options = options || {};

// Detect level if not set manually
obj.level = options.level === undefined ? supportsColor.level : options.level;
const scLevel = supportsColor ? supportsColor.level : 0;
obj.level = options.level === undefined ? scLevel : options.level;
obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
}

Expand Down
2 changes: 1 addition & 1 deletion test/level.js
Expand Up @@ -39,6 +39,6 @@ test('propagate enable/disable changes from child colors', t => {
m.level = oldLevel;
});

test.failing('disable colors if they are not supported', async t => {
test('disable colors if they are not supported', async t => {
t.is(await execa.stdout('node', [path.join(__dirname, '_fixture')]), 'test');
});

0 comments on commit 0827d3b

Please sign in to comment.