[Pkg-javascript-commits] [node-tap-mocha-reporter] 91/137: use color-support instead of supports-color

Bastien Roucariès rouca at moszumanska.debian.org
Thu Sep 7 09:49:29 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-tap-mocha-reporter.

commit 135a87d15ee56d89f99153ee22182333d5423d86
Author: isaacs <i at izs.me>
Date:   Sun Jul 17 23:42:36 2016 -0700

    use color-support instead of supports-color
    
    Swap diff styling for classic if 256 colors not enabled
---
 lib/reporters/base.js    | 2 +-
 lib/reporters/classic.js | 3 ++-
 package.json             | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/reporters/base.js b/lib/reporters/base.js
index 3fd4976..6ae8c75 100644
--- a/lib/reporters/base.js
+++ b/lib/reporters/base.js
@@ -6,7 +6,7 @@ var tty = require('tty')
   , diff = require('diff')
   , ms = require('../ms')
   , utils = require('../utils')
-  , supportsColor = process.env ? require('supports-color') : null;
+  , supportsColor = require('color-support')()
 
 /**
  * Save timer references to avoid Sinon interfering (see GH-237).
diff --git a/lib/reporters/classic.js b/lib/reporters/classic.js
index bc4f1b0..9d54cfa 100644
--- a/lib/reporters/classic.js
+++ b/lib/reporters/classic.js
@@ -10,6 +10,7 @@ var Base = require('./base')
   , diff = require('diff')
   , utils = require('../utils.js')
   , uclen = require('unicode-length').get
+  , colorSupport = require('color-support')()
 
 function hasOwnProperty (obj, key) {
   return Object.prototype.hasOwnProperty.call(obj, key)
@@ -44,7 +45,7 @@ function doDiff (found, wanted, palette) {
   // palette was easily distinguishable across all forms of color
   // deficiency.
 
-  palette = 6
+  palette = colorSupport.has256 ? 6 : 1
 
   var plain = ''
   var reset = '\u001b[m'
diff --git a/package.json b/package.json
index c7b6d70..f17c881 100644
--- a/package.json
+++ b/package.json
@@ -17,12 +17,12 @@
   },
   "homepage": "https://github.com/isaacs/tap-mocha-reporter",
   "dependencies": {
+    "color-support": "^1.1.0",
     "debug": "^2.1.3",
     "diff": "^1.3.2",
     "escape-string-regexp": "^1.0.3",
     "glob": "^7.0.5",
     "js-yaml": "^3.3.1",
-    "supports-color": "^1.3.1",
     "tap-parser": "^1.0.4",
     "unicode-length": "^1.0.0"
   },

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-tap-mocha-reporter.git



More information about the Pkg-javascript-commits mailing list