Skip to content

Commit

Permalink
now supports 256 color as well, simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
silverwind committed Jun 20, 2023
1 parent 4234e8e commit 22de484
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,7 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
}

if ('CI' in env) {
if ('GITEA_ACTIONS' in env) {
return 1;
}

if ('GITHUB_ACTIONS' in env) {
if ('GITHUB_ACTIONS' in env || 'GITEA_ACTIONS' in env) {
return 3;
}

Expand Down
6 changes: 3 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ test('return true if `DRONE` is in env', t => {
t.truthy(result.stdout);
});

test('return 1 if both `GITHUB_ACTIONS` and `GITEA_ACTIONS` are in env', t => {
process.env = {CI: true, GITHUB_ACTIONS: true, GITEA_ACTIONS: true};
test('return level 3 if `GITEA_ACTIONS` is in env', t => {
process.env = {CI: true, GITEA_ACTIONS: true};
const result = importFresh('./index.js');
t.is(result.stdout.level, 1);
t.is(result.stdout.level, 3);
});

test('return true if Codeship is in env', t => {
Expand Down

0 comments on commit 22de484

Please sign in to comment.