diff --git a/index.js b/index.js index 204889c..94c1ae5 100644 --- a/index.js +++ b/index.js @@ -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; } diff --git a/test/level.js b/test/level.js index 9caf6c4..85624ea 100644 --- a/test/level.js +++ b/test/level.js @@ -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'); });