modify Source

This commit is contained in:
wangxiao65 2020-09-03 17:22:58 +08:00
parent c29bffb865
commit f077292cf9
4 changed files with 7 additions and 36 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1,15 +1,17 @@
%{?nodejs_find_provides_and_requires}
%global enable_tests 1
%global packagename supports-color
Name: nodejs-has-color
Version: 0.1.7
Release: 1
Summary: Detects whether a terminal supports color
License: MIT
URL: https://github.com/sindresorhus/has-color
Source0: http://registry.npmjs.org/has-color/-/has-color-%{version}.tgz
Source1: https://raw.githubusercontent.com/sindresorhus/has-color/ab671b1f74846d9fb9caea8dc302603a865be3cc/test.js
URL: https://github.com/chalk/supports-color
#https://codeload.github.com/chalk/supports-color/tar.gz/v0.1.7
Source0: %{name}-%{version}.tar.gz
#https://opensource.org.licenses/MIT
Source2: LICENSE
Source1: LICENSE
BuildArch: noarch
ExclusiveArch: %{nodejs_arches} noarch
BuildRequires: nodejs-packaging
@ -20,9 +22,8 @@ BuildRequires: npm(mocha)
%{summary}.
%prep
%setup -q -n package
%setup -q -n %{packagename}-%{version}
cp -p %{SOURCE1} .
cp -p %{SOURCE2} .
%build

30
test.js
View File

@ -1,30 +0,0 @@
'use strict';
var assert = require('assert');
beforeEach(function () {
// clear the cache of the tested module
delete require.cache[require.resolve('./index')];
process.stdout.isTTY = true;
process.argv = [];
process.env = {};
});
it('should return false if not TTY', function () {
process.stdout.isTTY = false;
assert.equal(require('./index'), false);
});
it('should return false if --no-color flag is used', function () {
process.argv = ['--no-color'];
assert.equal(require('./index'), false);
});
it('should return true if --color flag is used', function () {
process.argv = ['--color'];
assert.equal(require('./index'), true);
});
it('should return true if `COLORTERM` is in env', function () {
process.env.COLORTERM = true;
assert.equal(require('./index'), true);
});