Open pr4j3sh opened 5 months ago
Apache project logo
body { background-color: #EEE; color: #222; line-height: 1.25 !important; }
width: auto;
margin: 0 auto;
}
@media (min-width: 425px) {
width: 420px;
margin: 0 auto;
}
}
@media (min-width: 850px) {
width: 850px;
margin: 0 auto;
}
}
@media (min-width: 1280px) {
width: 1270px;
margin: 0 auto;
}
}
@media (min-width: 1730px) {
width: 1700px;
margin: 0 auto;
}
}
@media (min-width: 2160px) {
width: auto;
margin: 0 auto;
}
}
.project_rect { color: #000; width: 400px; height: 340px; text-align: center; font-family: sans-serif; border: 1.5px solid #3338; border-radius: 5px; background-color: #FFF; display: inline-block; margin: 10px; font-size: 12px; position: relative; overflow: hidden; }
margin: 10px auto;
color: #000;
width: 1000px;
height: 80px;
text-align: center;
font-family: sans-serif;
font-size: 12px;
border: 1.5px solid #3338;
border-radius: 5px;
background-color: #FFFC;
padding: 4px;
position: relative;
overflow: hidden;
}
.project_logo { width: 400px; height: 170px; position: relative; vertical-align: middle; line-height: 180px; text-align: center; }
.project_logo { background: url(../images/transparent.png); background-size: 28px; }
.project_logo > img { position: absolute; top: 0; bottom: 0; right: 0; left: 0; margin:auto; } .project_rect > p { font-size: 11px; padding: 2px; }
form { font-family: sans-serif; font-size: 16px; text-align: center; }
h3 { text-align: center; font-family: sans-serif; color: #333; }
.img_download { border: 1px solid #3332; float: left; margin-left: 10px; padding: 2px; font-size: 10px; font-family: sans-serif; display: inline-block; overflow: hidden; width: 85px; line-height: 1.1; height: 50px; text-align: center; }
.img_download:hover { background: #FFC; }
Problem
Two test cases are failing, present at
line 44
andline 52
intest.js
(although 4 test cases are failing but I'm considering 2 since I was able to fix only 2, solution is provided below):index.js:72:1 ⚠ 72:1 Function _supportsColor has a complexity of 36. Maximum allowed is 20. complexity
1 warning
✔ return true if
FORCE_COLOR
is in env ✘ [fail]: return true ifFORCE_COLOR
is in env, but honor 256 ✘ [fail]: return true ifFORCE_COLOR
is in env, but honor 256 #2 ✔ CLI color flags precede other color support checks ✔FORCE_COLOR
environment variable precedes other color support checks ✔ return false ifFORCE_COLOR
is in env and is 0 ✔ do not cacheFORCE_COLOR
✔ return false if not TTY ✔ return false if --no-color flag is used ✔ return false if --no-colors flag is used ✔ return true if --color flag is used ✔ return true if --colors flag is used ✔ return true ifCOLORTERM
is in env ✔ support--color=true
flag ✔ support--color=always
flag ✔ support--color=false
flag ✔ support--color=256
flag ✔ level should be 2 if--color=256
flag is used ✔ support--color=16m
flag ✔ support--color=full
flag ✔ support--color=truecolor
flag ✔ level should be 3 if--color=16m
flag is used ✔ ignore post-terminator flags ✔ allow tests of the properties on false ✔ return false ifCI
is in env ✔ return true ifTRAVIS
is in env ✔ return true ifCIRCLECI
is in env ✔ return true ifAPPVEYOR
is in env ✔ return true ifGITLAB_CI
is in env ✔ return true ifBUILDKITE
is in env ✔ return true ifDRONE
is in env ✔ return level 3 ifGITEA_ACTIONS
is in env ✔ return true if Codeship is in env ✔ return false ifTEAMCITY_VERSION
is in env and is < 9.1 ✔ return level 1 ifTEAMCITY_VERSION
is in env and is >= 9.1 ✔ support rxvt ✔ prefer level 2/xterm over COLORTERM ✔ support screen-256color ✔ support putty-256color ✔ level should be 3 when using iTerm 3.0 ✔ level should be 2 when using iTerm 2.9 ✔ return level 1 if on Windows earlier than 10 build 10586 ✔ return level 2 if on Windows 10 build 10586 or later ✔ return level 3 if on Windows 10 build 14931 or later ✘ [fail]: return level 2 when FORCE_COLOR is set when not TTY in xterm256 ✔ supports setting a color level using FORCE_COLOR ✔ FORCE_COLOR maxes out at a value of 3 ✘ [fail]: FORCE_COLOR works when set via command line (all values are strings) ✔ return false whenTERM
is set to dumb ✔ return false whenTERM
is set to dumb whenTERM_PROGRAM
is set ✔ return false whenTERM
is set to dumb when run on Windows ✔ return level 1 whenTERM
is set to dumb whenFORCE_COLOR
is set ✔ ignore flags when sniffFlags=false ─return true if
FORCE_COLOR
is in env, but honor 256test.js:44
43: t.truthy(result.stdout); 44: t.is(result.stdout.level, 2); 45: });
Difference (- actual, + expected):
1
2
› file://test.js:44:4
return true if
FORCE_COLOR
is in env, but honor 256 #2test.js:52
51: t.truthy(result.stdout); 52: t.is(result.stdout.level, 2); 53: });
Difference (- actual, + expected):
1
2
› file://test.js:52:4
return level 2 when FORCE_COLOR is set when not TTY in xterm256
test.js:354
353: t.truthy(result.stdout); 354: t.is(result.stdout.level, 2); 355: });
Difference (- actual, + expected):
1
2
› file://test.js:354:4
FORCE_COLOR works when set via command line (all values are strings)
test.js:398
397: t.truthy(result.stdout); 398: t.is(result.stdout.level, 2); 399:
Difference (- actual, + expected):
1
2
› file://test.js:398:4
─
4 tests failed
Solution
test.js
,process.argv
is set as--color=256
andprocess.env.FORCE_COLOR
is set to'true'
and1
.index.js
, atline 80
, we have anif
statement that checks value offorceColor
and returns it,Then we have another
if
condition atline 84
that checks forcolor=256
flag,forceColor
is defined abovecolor=256
inindex.js
. Hence, the value offorceColor
, i.e.,1
is returned whereas expected is2
.To fix this, issue we can simply define
forceColor
condition belowcolor=256
condition.if (forceColor !== undefined) { return forceColor; }
Miscellaneous