[Pkg-javascript-commits] [node-supports-color] 01/02: Merging upstream version 3.2.3.

Mathias Behrle mbehrle at moszumanska.debian.org
Tue Jan 24 15:36:41 UTC 2017


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

mbehrle pushed a commit to branch master
in repository node-supports-color.

commit b1b403ed9b4a693ac1a86b09a671f9fdd85102e8
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Tue Jan 24 16:34:33 2017 +0100

    Merging upstream version 3.2.3.
---
 .travis.yml  |  4 ++--
 index.js     | 22 +++++++++++++++++-----
 package.json |  4 ++--
 test.js      | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 57 insertions(+), 9 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index bf55bd6..97baceb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,11 +1,11 @@
 sudo: false
 language: node_js
 node_js:
-  - 'iojs'
+  - 'stable'
   - '0.12'
   - '0.10'
   - '0.8'
 before_install:
-  - npm install -g npm
+  - npm install -g npm at 2
 script:
   - npm run travis
diff --git a/index.js b/index.js
index 113040d..2571c73 100644
--- a/index.js
+++ b/index.js
@@ -46,15 +46,19 @@ var supportLevel = (function () {
 		return 1;
 	}
 
-	if ('COLORTERM' in process.env) {
-		return 1;
-	}
+	if ('CI' in process.env) {
+		if ('TRAVIS' in process.env || process.env.CI === 'Travis') {
+			return 1;
+		}
 
-	if (process.env.TERM === 'dumb') {
 		return 0;
 	}
 
-	if (/^xterm-256(?:color)?/.test(process.env.TERM)) {
+	if ('TEAMCITY_VERSION' in process.env) {
+		return process.env.TEAMCITY_VERSION.match(/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/) === null ? 0 : 1;
+	}
+
+	if (/^(screen|xterm)-256(?:color)?/.test(process.env.TERM)) {
 		return 2;
 	}
 
@@ -62,6 +66,14 @@ var supportLevel = (function () {
 		return 1;
 	}
 
+	if ('COLORTERM' in process.env) {
+		return 1;
+	}
+
+	if (process.env.TERM === 'dumb') {
+		return 0;
+	}
+
 	return 0;
 })();
 
diff --git a/package.json b/package.json
index 0f08cb9..0cc4b38 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "supports-color",
-  "version": "3.1.2",
+  "version": "3.2.3",
   "description": "Detect whether a terminal supports color",
   "license": "MIT",
   "repository": "chalk/supports-color",
@@ -11,7 +11,7 @@
   },
   "maintainers": [
     "Sindre Sorhus <sindresorhus at gmail.com> (sindresorhus.com)",
-    "Joshua Appelman <jappelman at xebia.com> (jbnicolai.com)",
+    "Joshua Boy Nicolai Appelman <joshua at jbna.nl> (jbna.nl)",
     "JD Ballard <i.am.qix at gmail.com> (github.com/qix-)"
   ],
   "browser": "browser.js",
diff --git a/test.js b/test.js
index 034b8bb..b9d7984 100644
--- a/test.js
+++ b/test.js
@@ -126,3 +126,39 @@ it('should allow tests of the properties on false', function () {
 	assert.equal(Boolean(result.has16m), false);
 	assert.equal(result.level > 0, false);
 });
+
+it('should return false if `CI` is in env', function () {
+	process.env.CI = 'AppVeyor';
+	var result = requireUncached('./');
+	assert.equal(Boolean(result), false);
+});
+
+it('should return true if `TRAVIS` is in env', function () {
+	process.env = {CI: 'Travis', TRAVIS: '1'};
+	var result = requireUncached('./');
+	assert.equal(Boolean(result), true);
+});
+
+it('should return false if `TEAMCITY_VERSION` is in env and is < 9.1', function () {
+	process.env.TEAMCITY_VERSION = '9.0.5 (build 32523)';
+	var result = requireUncached('./');
+	assert.equal(Boolean(result), false);
+});
+
+it('should return level 1 if `TEAMCITY_VERSION` is in env and is >= 9.1', function () {
+	process.env.TEAMCITY_VERSION = '9.1.0 (build 32523)';
+	var result = requireUncached('./');
+	assert.equal(result.level, 1);
+});
+
+it('should prefer level 2/xterm over COLORTERM', function () {
+	process.env = {COLORTERM: '1', TERM: 'xterm-256color'};
+	var result = requireUncached('./');
+	assert.equal(result.level, 2);
+});
+
+it('should support screen-256color', function () {
+	process.env = {TERM: 'screen-256color'};
+	var result = requireUncached('./');
+	assert.equal(result.level, 2);
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-supports-color.git



More information about the Pkg-javascript-commits mailing list