Codebase list node-ci-info / upstream/3.2.0
Import upstream version 3.2.0 Debian Janitor 2 years ago
13 changed file(s) with 245 addition(s) and 673 deletion(s). Raw diff Collapse all Expand all
+0
-4
.npmignore less more
0 node_modules
1 .github
2 .travis.yml
3 test.js
00 # Changelog
1
2 ## v3.2.0
3
4 - support LayerCI ([#68](https://github.com/watson/ci-info/pull/68))
5 - support Appcircle ([#69](https://github.com/watson/ci-info/pull/69))
6 - support Codefresh CI ([#65](https://github.com/watson/ci-info/pull/65))
7 - Add support for nodejs v16
8
9 ## v3.1.1
10
11 Bug Fixes:
12
13 - remove duplicate declaration in typings
14
15 ## v3.1.0
16
17 Features:
18
19 - add typings
20
21 ## v3.0.0
22
23 Features:
24
25 - Add support nodejs versions: 14, 15
26 - support Nevercode ([#30](https://github.com/watson/ci-info/pull/30))
27 - support Render CI ([#36](https://github.com/watson/ci-info/pull/36))
28 - support Now CI ([#37](https://github.com/watson/ci-info/pull/37))
29 - support GitLab PR ([#59](https://github.com/watson/ci-info/pull/59))
30 - support Screwdriver CD ([#60](https://github.com/watson/ci-info/pull/60))
31 - support Visual Studio App Center ([#61](https://github.com/watson/ci-info/pull/61))
32
33 Bug Fixes:
34
35 - update Netlify env constant ([#47](https://github.com/watson/ci-info/pull/47))
36
37 Breaking changes:
38
39 - Drop support for Node.js end-of-life versions: 6, 13
40 - replace `Zeit Now` with `Vercel` ([#55](https://github.com/watson/ci-info/pull/55))
141
242 ## v2.0.0
343
444 Breaking changes:
545
6 * Drop support for Node.js end-of-life versions: 0.10, 0.12, 4, 5, 7,
46 - Drop support for Node.js end-of-life versions: 0.10, 0.12, 4, 5, 7,
747 and 9
8 * Team Foundation Server will now be detected as Azure Pipelines. The
48 - Team Foundation Server will now be detected as Azure Pipelines. The
949 constant `ci.TFS` no longer exists - use `ci.AZURE_PIPELINES` instead
10 * Remove deprecated `ci.TDDIUM` constant - use `ci.SOLANDO` instead
50 - Remove deprecated `ci.TDDIUM` constant - use `ci.SOLANDO` instead
1151
1252 New features:
1353
14 * feat: support Azure Pipelines ([#23](https://github.com/watson/ci-info/pull/23))
15 * feat: support Netlify CI ([#26](https://github.com/watson/ci-info/pull/26))
16 * feat: support Bitbucket pipelines PR detection ([#27](https://github.com/watson/ci-info/pull/27))
54 - feat: support Azure Pipelines ([#23](https://github.com/watson/ci-info/pull/23))
55 - feat: support Netlify CI ([#26](https://github.com/watson/ci-info/pull/26))
56 - feat: support Bitbucket pipelines PR detection ([#27](https://github.com/watson/ci-info/pull/27))
1757
1858 ## v1.6.0
1959
20 * feat: add Sail CI support
21 * feat: add Buddy support
22 * feat: add Bitrise support
23 * feat: detect Jenkins PRs
24 * feat: detect Drone PRs
60 - feat: add Sail CI support
61 - feat: add Buddy support
62 - feat: add Bitrise support
63 - feat: detect Jenkins PRs
64 - feat: detect Drone PRs
2565
2666 ## v1.5.1
2767
28 * fix: use full path to vendors.json
68 - fix: use full path to vendors.json
2969
3070 ## v1.5.0
3171
32 * feat: add dsari detection ([#15](https://github.com/watson/ci-info/pull/15))
33 * feat: add ci.isPR ([#16](https://github.com/watson/ci-info/pull/16))
72 - feat: add dsari detection ([#15](https://github.com/watson/ci-info/pull/15))
73 - feat: add ci.isPR ([#16](https://github.com/watson/ci-info/pull/16))
3474
3575 ## v1.4.0
3676
37 * feat: add Cirrus CI detection ([#13](https://github.com/watson/ci-info/pull/13))
38 * feat: add Shippable CI detection ([#14](https://github.com/watson/ci-info/pull/14))
77 - feat: add Cirrus CI detection ([#13](https://github.com/watson/ci-info/pull/13))
78 - feat: add Shippable CI detection ([#14](https://github.com/watson/ci-info/pull/14))
3979
4080 ## v1.3.1
4181
42 * chore: reduce npm package size by not including `.github` folder content ([#11](https://github.com/watson/ci-info/pull/11))
82 - chore: reduce npm package size by not including `.github` folder content ([#11](https://github.com/watson/ci-info/pull/11))
4383
4484 ## v1.3.0
4585
46 * feat: add support for Strider CD
47 * chore: deprecate vendor constant `TDDIUM` in favor of `SOLANO`
48 * docs: add missing vendor constant to docs
86 - feat: add support for Strider CD
87 - chore: deprecate vendor constant `TDDIUM` in favor of `SOLANO`
88 - docs: add missing vendor constant to docs
4989
5090 ## v1.2.0
5191
52 * feat: detect solano-ci ([#9](https://github.com/watson/ci-info/pull/9))
92 - feat: detect solano-ci ([#9](https://github.com/watson/ci-info/pull/9))
5393
5494 ## v1.1.3
5595
56 * fix: fix spelling of Hunson in `ci.name`
96 - fix: fix spelling of Hunson in `ci.name`
5797
5898 ## v1.1.2
5999
60 * fix: no more false positive matches for Jenkins
100 - fix: no more false positive matches for Jenkins
61101
62102 ## v1.1.1
63103
64 * docs: sort lists of CI servers in README.md
65 * docs: add missing AWS CodeBuild to the docs
104 - docs: sort lists of CI servers in README.md
105 - docs: add missing AWS CodeBuild to the docs
66106
67107 ## v1.1.0
68108
69 * feat: add AWS CodeBuild to CI detection ([#2](https://github.com/watson/ci-info/pull/2))
109 - feat: add AWS CodeBuild to CI detection ([#2](https://github.com/watson/ci-info/pull/2))
70110
71111 ## v1.0.1
72112
73 * chore: reduce npm package size by using an `.npmignore` file ([#3](https://github.com/watson/ci-info/pull/3))
113 - chore: reduce npm package size by using an `.npmignore` file ([#3](https://github.com/watson/ci-info/pull/3))
74114
75115 ## v1.0.0
76116
77 * Initial release
117 - Initial release
00 The MIT License (MIT)
11
2 Copyright (c) 2016-2018 Thomas Watson Steen
2 Copyright (c) 2016-2021 Thomas Watson Steen
33
44 Permission is hereby granted, free of charge, to any person obtaining a copy
55 of this software and associated documentation files (the "Software"), to deal
66 if your CI server isn't properly detected :)
77
88 [![npm](https://img.shields.io/npm/v/ci-info.svg)](https://www.npmjs.com/package/ci-info)
9 [![Build status](https://travis-ci.org/watson/ci-info.svg?branch=master)](https://travis-ci.org/watson/ci-info)
9 [![Tests](https://github.com/watson/ci-info/workflows/Tests/badge.svg)](https://github.com/watson/ci-info/actions)
1010 [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)
1111
1212 ## Installation
3131
3232 Officially supported CI servers:
3333
34 | Name | Constant | isPR |
35 |------|----------|------|
36 | [AWS CodeBuild](https://aws.amazon.com/codebuild/) | `ci.CODEBUILD` | 🚫 |
37 | [AppVeyor](http://www.appveyor.com) | `ci.APPVEYOR` | ✅ |
38 | [Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/) | `ci.AZURE_PIPELINES` | ✅ |
39 | [Bamboo](https://www.atlassian.com/software/bamboo) by Atlassian | `ci.BAMBOO` | 🚫 |
40 | [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) | `ci.BITBUCKET` | ✅ |
41 | [Bitrise](https://www.bitrise.io/) | `ci.BITRISE` | ✅ |
42 | [Buddy](https://buddy.works/) | `ci.BUDDY` | ✅ |
43 | [Buildkite](https://buildkite.com) | `ci.BUILDKITE` | ✅ |
44 | [CircleCI](http://circleci.com) | `ci.CIRCLE` | ✅ |
45 | [Cirrus CI](https://cirrus-ci.org) | `ci.CIRRUS` | ✅ |
46 | [Codeship](https://codeship.com) | `ci.CODESHIP` | 🚫 |
47 | [Drone](https://drone.io) | `ci.DRONE` | ✅ |
48 | [dsari](https://github.com/rfinnie/dsari) | `ci.DSARI` | 🚫 |
49 | [GitLab CI](https://about.gitlab.com/gitlab-ci/) | `ci.GITLAB` | 🚫 |
50 | [GoCD](https://www.go.cd/) | `ci.GOCD` | 🚫 |
51 | [Hudson](http://hudson-ci.org) | `ci.HUDSON` | 🚫 |
52 | [Jenkins CI](https://jenkins-ci.org) | `ci.JENKINS` | ✅ |
53 | [Magnum CI](https://magnum-ci.com) | `ci.MAGNUM` | 🚫 |
54 | [Netlify CI](https://www.netlify.com/) | `ci.NETLIFY` | ✅ |
55 | [Sail CI](https://sail.ci/) | `ci.SAIL` | ✅ |
56 | [Semaphore](https://semaphoreci.com) | `ci.SEMAPHORE` | ✅ |
57 | [Shippable](https://www.shippable.com/) | `ci.SHIPPABLE` | ✅ |
58 | [Solano CI](https://www.solanolabs.com/) | `ci.SOLANO` | ✅ |
59 | [Strider CD](https://strider-cd.github.io/) | `ci.STRIDER` | 🚫 |
60 | [TaskCluster](http://docs.taskcluster.net) | `ci.TASKCLUSTER` | 🚫 |
61 | [TeamCity](https://www.jetbrains.com/teamcity/) by JetBrains | `ci.TEAMCITY` | 🚫 |
62 | [Travis CI](http://travis-ci.org) | `ci.TRAVIS` | ✅ |
34 | Name | Constant | isPR |
35 | ------------------------------------------------------------------------------- | -------------------- | ---- |
36 | [AWS CodeBuild](https://aws.amazon.com/codebuild/) | `ci.CODEBUILD` | 🚫 |
37 | [AppVeyor](http://www.appveyor.com) | `ci.APPVEYOR` | ✅ |
38 | [Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/) | `ci.AZURE_PIPELINES` | ✅ |
39 | [Appcircle](https://appcircle.io/) | `ci.APPCIRCLE` | 🚫 |
40 | [Bamboo](https://www.atlassian.com/software/bamboo) by Atlassian | `ci.BAMBOO` | 🚫 |
41 | [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) | `ci.BITBUCKET` | ✅ |
42 | [Bitrise](https://www.bitrise.io/) | `ci.BITRISE` | ✅ |
43 | [Buddy](https://buddy.works/) | `ci.BUDDY` | ✅ |
44 | [Buildkite](https://buildkite.com) | `ci.BUILDKITE` | ✅ |
45 | [CircleCI](http://circleci.com) | `ci.CIRCLE` | ✅ |
46 | [Cirrus CI](https://cirrus-ci.org) | `ci.CIRRUS` | ✅ |
47 | [Codefresh](https://codefresh.io/) | `ci.CODEFRESH` | ✅ |
48 | [Codeship](https://codeship.com) | `ci.CODESHIP` | 🚫 |
49 | [Drone](https://drone.io) | `ci.DRONE` | ✅ |
50 | [dsari](https://github.com/rfinnie/dsari) | `ci.DSARI` | 🚫 |
51 | [GitHub Actions](https://github.com/features/actions/) | `ci.GITHUB_ACTIONS` | ✅ |
52 | [GitLab CI](https://about.gitlab.com/gitlab-ci/) | `ci.GITLAB` | ✅ |
53 | [GoCD](https://www.go.cd/) | `ci.GOCD` | 🚫 |
54 | [Hudson](http://hudson-ci.org) | `ci.HUDSON` | 🚫 |
55 | [Jenkins CI](https://jenkins-ci.org) | `ci.JENKINS` | ✅ |
56 | [LayerCI](https://layerci.com/) | `ci.LAYERCI` | ✅ |
57 | [Magnum CI](https://magnum-ci.com) | `ci.MAGNUM` | 🚫 |
58 | [Netlify CI](https://www.netlify.com/) | `ci.NETLIFY` | ✅ |
59 | [Nevercode](http://nevercode.io/) | `ci.NEVERCODE` | ✅ |
60 | [Render](https://render.com/) | `ci.RENDER` | ✅ |
61 | [Sail CI](https://sail.ci/) | `ci.SAIL` | ✅ |
62 | [Screwdriver](https://screwdriver.cd/) | `ci.SCREWDRIVER` | ✅ |
63 | [Semaphore](https://semaphoreci.com) | `ci.SEMAPHORE` | ✅ |
64 | [Shippable](https://www.shippable.com/) | `ci.SHIPPABLE` | ✅ |
65 | [Solano CI](https://www.solanolabs.com/) | `ci.SOLANO` | ✅ |
66 | [Strider CD](https://strider-cd.github.io/) | `ci.STRIDER` | 🚫 |
67 | [TaskCluster](http://docs.taskcluster.net) | `ci.TASKCLUSTER` | 🚫 |
68 | [TeamCity](https://www.jetbrains.com/teamcity/) by JetBrains | `ci.TEAMCITY` | 🚫 |
69 | [Travis CI](http://travis-ci.org) | `ci.TRAVIS` | ✅ |
70 | [Vercel](https://vercel.com/) | `ci.VERCEL` | 🚫 |
71 | [Visual Studio App Center](https://appcenter.ms/) | `ci.APPCENTER` | 🚫 |
6372
6473 ## API
6574
0 /**
1 * Returns a boolean. Will be `true` if the code is running on a CI server,
2 * otherwise `false`.
3 *
4 * Some CI servers not listed here might still trigger the `ci.isCI`
5 * boolean to be set to `true` if they use certain vendor neutral environment
6 * variables. In those cases `ci.name` will be `null` and no vendor specific
7 * boolean will be set to `true`.
8 */
9 export const isCI: boolean;
10 /**
11 * Returns a boolean if PR detection is supported for the current CI server.
12 * Will be `true` if a PR is being tested, otherwise `false`. If PR detection is
13 * not supported for the current CI server, the value will be `null`.
14 */
15 export const isPR: boolean | null;
16 /**
17 * Returns a string containing name of the CI server the code is running on. If
18 * CI server is not detected, it returns `null`.
19 *
20 * Don't depend on the value of this string not to change for a specific vendor.
21 * If you find your self writing `ci.name === 'Travis CI'`, you most likely want
22 * to use `ci.TRAVIS` instead.
23 */
24 export const name: string | null;
25
26 export const APPVEYOR: boolean;
27 export const AZURE_PIPELINES: boolean;
28 export const APPCIRCLE: boolean;
29 export const BAMBOO: boolean;
30 export const BITBUCKET: boolean;
31 export const BITRISE: boolean;
32 export const BUDDY: boolean;
33 export const BUILDKITE: boolean;
34 export const CIRCLE: boolean;
35 export const CIRRUS: boolean;
36 export const CODEBUILD: boolean;
37 export const CODEFRESH: boolean;
38 export const CODESHIP: boolean;
39 export const DRONE: boolean;
40 export const DSARI: boolean;
41 export const GITHUB_ACTIONS: boolean;
42 export const GITLAB: boolean;
43 export const GOCD: boolean;
44 export const HUDSON: boolean;
45 export const JENKINS: boolean;
46 export const LAYERCI: boolean;
47 export const MAGNUM: boolean;
48 export const NETLIFY: boolean;
49 export const NEVERCODE: boolean;
50 export const RENDER: boolean;
51 export const SAIL: boolean;
52 export const SEMAPHORE: boolean;
53 export const SCREWDRIVER: boolean;
54 export const SHIPPABLE: boolean;
55 export const SOLANO: boolean;
56 export const STRIDER: boolean;
57 export const TASKCLUSTER: boolean;
58 export const TEAMCITY: boolean;
59 export const TRAVIS: boolean;
60 export const VERCEL: boolean;
61 export const APPCENTER: boolean;
00 'use strict'
11
2 var vendors = require('./vendors.json')
2 const vendors = require('./vendors.json')
33
4 var env = process.env
4 const env = process.env
55
66 // Used for testing only
77 Object.defineProperty(exports, '_vendors', {
1212 exports.isPR = null
1313
1414 vendors.forEach(function (vendor) {
15 var envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env]
16 var isCI = envs.every(function (obj) {
15 const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env]
16 const isCI = envs.every(function (obj) {
1717 return checkEnv(obj)
1818 })
1919
00 {
11 "name": "ci-info",
2 "version": "2.0.0",
2 "version": "3.2.0",
33 "description": "Get details about the current Continuous Integration environment",
44 "main": "index.js",
5 "dependencies": {},
6 "devDependencies": {
7 "clear-require": "^1.0.1",
8 "standard": "^12.0.1",
9 "tape": "^4.9.1"
10 },
11 "scripts": {
12 "test": "standard && node test.js"
13 },
5 "typings": "index.d.ts",
6 "author": "Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)",
7 "license": "MIT",
148 "repository": {
159 "type": "git",
1610 "url": "https://github.com/watson/ci-info.git"
1711 },
12 "bugs": {
13 "url": "https://github.com/watson/ci-info/issues"
14 },
15 "homepage": "https://github.com/watson/ci-info",
1816 "keywords": [
1917 "ci",
2018 "continuous",
2220 "test",
2321 "detect"
2422 ],
25 "author": "Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)",
26 "license": "MIT",
27 "bugs": {
28 "url": "https://github.com/watson/ci-info/issues"
29 },
30 "homepage": "https://github.com/watson/ci-info",
3123 "coordinates": [
3224 55.778231,
3325 12.593179
34 ]
26 ],
27 "scripts": {
28 "test": "standard && node test.js"
29 },
30 "devDependencies": {
31 "clear-module": "^4.1.1",
32 "standard": "^16.0.3",
33 "tape": "^5.2.2"
34 }
3535 }
+0
-468
test.js less more
0 'use strict'
1
2 var test = require('tape')
3 var clearRequire = require('clear-require')
4
5 var isActualPR = !!(process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST !== 'false')
6
7 test('Known CI', function (t) {
8 process.env.TRAVIS = 'true'
9
10 var ci = require('./')
11
12 t.ok(Array.isArray(ci._vendors))
13 t.ok(ci._vendors.length > 0)
14
15 t.equal(ci.isCI, true)
16 t.equal(ci.isPR, isActualPR)
17 t.equal(ci.name, 'Travis CI')
18 t.equal(ci.TRAVIS, true)
19 assertVendorConstants('TRAVIS', ci, t)
20
21 t.end()
22 })
23
24 test('Not CI', function (t) {
25 delete process.env.CI
26 delete process.env.CONTINUOUS_INTEGRATION
27 delete process.env.BUILD_NUMBER
28 delete process.env.TRAVIS
29
30 clearRequire('./')
31 var ci = require('./')
32
33 t.equal(ci.isCI, false)
34 t.equal(ci.isPR, null)
35 t.equal(ci.name, null)
36 t.equal(ci.TRAVIS, false)
37 assertVendorConstants(null, ci, t)
38
39 t.end()
40 })
41
42 test('Unknown CI', function (t) {
43 process.env.CI = 'true'
44
45 clearRequire('./')
46 var ci = require('./')
47
48 t.equal(ci.isCI, true)
49 t.equal(ci.isPR, null)
50 t.equal(ci.name, null)
51 t.equal(ci.TRAVIS, false)
52 assertVendorConstants(null, ci, t)
53
54 t.end()
55 })
56
57 test('AppVeyor - PR', function (t) {
58 process.env.APPVEYOR = 'true'
59 process.env.APPVEYOR_PULL_REQUEST_NUMBER = '42'
60
61 clearRequire('./')
62 var ci = require('./')
63
64 t.equal(ci.isCI, true)
65 t.equal(ci.isPR, true)
66 t.equal(ci.name, 'AppVeyor')
67 t.equal(ci.APPVEYOR, true)
68 assertVendorConstants('APPVEYOR', ci, t)
69
70 delete process.env.APPVEYOR
71 delete process.env.APPVEYOR_PULL_REQUEST_NUMBER
72
73 t.end()
74 })
75
76 test('AppVeyor - Not PR', function (t) {
77 process.env.APPVEYOR = 'true'
78
79 clearRequire('./')
80 var ci = require('./')
81
82 t.equal(ci.isCI, true)
83 t.equal(ci.isPR, false)
84 t.equal(ci.name, 'AppVeyor')
85 t.equal(ci.APPVEYOR, true)
86 assertVendorConstants('APPVEYOR', ci, t)
87
88 delete process.env.APPVEYOR
89
90 t.end()
91 })
92
93 test('Azure Pipelines - PR', function (t) {
94 process.env.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI = 'https://dev.azure.com/Contoso'
95 process.env.SYSTEM_PULLREQUEST_PULLREQUESTID = '42'
96
97 clearRequire('./')
98 var ci = require('./')
99
100 t.equal(ci.isCI, true)
101 t.equal(ci.isPR, true)
102 t.equal(ci.name, 'Azure Pipelines')
103 t.equal(ci.AZURE_PIPELINES, true)
104 assertVendorConstants('AZURE_PIPELINES', ci, t)
105
106 delete process.env.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI
107 delete process.env.SYSTEM_PULLREQUEST_PULLREQUESTID
108
109 t.end()
110 })
111
112 test('Azure Pipelines - Not PR', function (t) {
113 process.env.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI = 'https://dev.azure.com/Contoso'
114
115 clearRequire('./')
116 var ci = require('./')
117
118 t.equal(ci.isCI, true)
119 t.equal(ci.isPR, false)
120 t.equal(ci.name, 'Azure Pipelines')
121 t.equal(ci.AZURE_PIPELINES, true)
122 assertVendorConstants('AZURE_PIPELINES', ci, t)
123
124 delete process.env.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI
125
126 t.end()
127 })
128
129 test('Bitbucket Pipelines - PR', function (t) {
130 process.env.BITBUCKET_COMMIT = 'true'
131 process.env.BITBUCKET_PR_ID = '42'
132
133 clearRequire('./')
134 var ci = require('./')
135
136 t.equal(ci.isCI, true)
137 t.equal(ci.isPR, true)
138 t.equal(ci.name, 'Bitbucket Pipelines')
139 t.equal(ci.BITBUCKET, true)
140 assertVendorConstants('BITBUCKET', ci, t)
141
142 delete process.env.BITBUCKET_COMMIT
143 delete process.env.BITBUCKET_PR_ID
144
145 t.end()
146 })
147
148 test('Bitbucket Pipelines - Not PR', function (t) {
149 process.env.BITBUCKET_COMMIT = 'true'
150
151 clearRequire('./')
152 var ci = require('./')
153
154 t.equal(ci.isCI, true)
155 t.equal(ci.isPR, false)
156 t.equal(ci.name, 'Bitbucket Pipelines')
157 t.equal(ci.BITBUCKET, true)
158 assertVendorConstants('BITBUCKET', ci, t)
159
160 delete process.env.BITBUCKET_COMMIT
161
162 t.end()
163 })
164
165 test('Buildkite - PR', function (t) {
166 process.env.BUILDKITE = 'true'
167 process.env.BUILDKITE_PULL_REQUEST = '42'
168
169 clearRequire('./')
170 var ci = require('./')
171
172 t.equal(ci.isCI, true)
173 t.equal(ci.isPR, true)
174 t.equal(ci.name, 'Buildkite')
175 t.equal(ci.BUILDKITE, true)
176 assertVendorConstants('BUILDKITE', ci, t)
177
178 delete process.env.BUILDKITE
179 delete process.env.BUILDKITE_PULL_REQUEST
180
181 t.end()
182 })
183
184 test('Buildkite - Not PR', function (t) {
185 process.env.BUILDKITE = 'true'
186 process.env.BUILDKITE_PULL_REQUEST = 'false'
187
188 clearRequire('./')
189 var ci = require('./')
190
191 t.equal(ci.isCI, true)
192 t.equal(ci.isPR, false)
193 t.equal(ci.name, 'Buildkite')
194 t.equal(ci.BUILDKITE, true)
195 assertVendorConstants('BUILDKITE', ci, t)
196
197 delete process.env.BUILDKITE
198 delete process.env.BUILDKITE_PULL_REQUEST
199
200 t.end()
201 })
202
203 test('CircleCI - PR', function (t) {
204 process.env.CIRCLECI = 'true'
205 process.env.CIRCLE_PULL_REQUEST = '42'
206
207 clearRequire('./')
208 var ci = require('./')
209
210 t.equal(ci.isCI, true)
211 t.equal(ci.isPR, true)
212 t.equal(ci.name, 'CircleCI')
213 t.equal(ci.CIRCLE, true)
214 assertVendorConstants('CIRCLE', ci, t)
215
216 delete process.env.CIRCLECI
217 delete process.env.CIRCLE_PULL_REQUEST
218
219 t.end()
220 })
221
222 test('CircleCI - Not PR', function (t) {
223 process.env.CIRCLECI = 'true'
224
225 clearRequire('./')
226 var ci = require('./')
227
228 t.equal(ci.isCI, true)
229 t.equal(ci.isPR, false)
230 t.equal(ci.name, 'CircleCI')
231 t.equal(ci.CIRCLE, true)
232 assertVendorConstants('CIRCLE', ci, t)
233
234 delete process.env.CIRCLECI
235
236 t.end()
237 })
238
239 test('Cirrus CI - PR', function (t) {
240 process.env.CIRRUS_CI = 'true'
241 process.env.CIRRUS_PR = '42'
242
243 clearRequire('./')
244 var ci = require('./')
245
246 t.equal(ci.isCI, true)
247 t.equal(ci.isPR, true)
248 t.equal(ci.name, 'Cirrus CI')
249 t.equal(ci.CIRRUS, true)
250 assertVendorConstants('CIRRUS', ci, t)
251
252 delete process.env.CIRRUS_CI
253 delete process.env.CIRRUS_PR
254
255 t.end()
256 })
257
258 test('Cirrus CI - Not PR', function (t) {
259 process.env.CIRRUS_CI = 'true'
260
261 clearRequire('./')
262 var ci = require('./')
263
264 t.equal(ci.isCI, true)
265 t.equal(ci.isPR, false)
266 t.equal(ci.name, 'Cirrus CI')
267 t.equal(ci.CIRRUS, true)
268 assertVendorConstants('CIRRUS', ci, t)
269
270 delete process.env.CIRRUS_CI
271
272 t.end()
273 })
274
275 test('Semaphore - PR', function (t) {
276 process.env.SEMAPHORE = 'true'
277 process.env.PULL_REQUEST_NUMBER = '42'
278
279 clearRequire('./')
280 var ci = require('./')
281
282 t.equal(ci.isCI, true)
283 t.equal(ci.isPR, true)
284 t.equal(ci.name, 'Semaphore')
285 t.equal(ci.SEMAPHORE, true)
286 assertVendorConstants('SEMAPHORE', ci, t)
287
288 delete process.env.SEMAPHORE
289 delete process.env.PULL_REQUEST_NUMBER
290
291 t.end()
292 })
293
294 test('Semaphore - Not PR', function (t) {
295 process.env.SEMAPHORE = 'true'
296
297 clearRequire('./')
298 var ci = require('./')
299
300 t.equal(ci.isCI, true)
301 t.equal(ci.isPR, false)
302 t.equal(ci.name, 'Semaphore')
303 t.equal(ci.SEMAPHORE, true)
304 assertVendorConstants('SEMAPHORE', ci, t)
305
306 delete process.env.SEMAPHORE
307
308 t.end()
309 })
310
311 test('Shippable - PR', function (t) {
312 process.env.SHIPPABLE = 'true'
313 process.env.IS_PULL_REQUEST = 'true'
314
315 clearRequire('./')
316 var ci = require('./')
317
318 t.equal(ci.isCI, true)
319 t.equal(ci.isPR, true)
320 t.equal(ci.name, 'Shippable')
321 t.equal(ci.SHIPPABLE, true)
322 assertVendorConstants('SHIPPABLE', ci, t)
323
324 delete process.env.SHIPPABLE
325 delete process.env.IS_PULL_REQUEST
326
327 t.end()
328 })
329
330 test('Semaphore - Not PR', function (t) {
331 process.env.SHIPPABLE = 'true'
332 process.env.IS_PULL_REQUEST = 'false'
333
334 clearRequire('./')
335 var ci = require('./')
336
337 t.equal(ci.isCI, true)
338 t.equal(ci.isPR, false)
339 t.equal(ci.name, 'Shippable')
340 t.equal(ci.SHIPPABLE, true)
341 assertVendorConstants('SHIPPABLE', ci, t)
342
343 delete process.env.SHIPPABLE
344 delete process.env.IS_PULL_REQUEST
345
346 t.end()
347 })
348
349 test('Solano CI - PR', function (t) {
350 process.env.TDDIUM = 'true'
351 process.env.TDDIUM_PR_ID = '42'
352
353 clearRequire('./')
354 var ci = require('./')
355
356 t.equal(ci.isCI, true)
357 t.equal(ci.isPR, true)
358 t.equal(ci.name, 'Solano CI')
359 t.equal(ci.SOLANO, true)
360 assertVendorConstants('SOLANO', ci, t)
361
362 delete process.env.TDDIUM
363 delete process.env.TDDIUM_PR_ID
364
365 t.end()
366 })
367
368 test('Solano CI - Not PR', function (t) {
369 process.env.TDDIUM = 'true'
370
371 clearRequire('./')
372 var ci = require('./')
373
374 t.equal(ci.isCI, true)
375 t.equal(ci.isPR, false)
376 t.equal(ci.name, 'Solano CI')
377 t.equal(ci.SOLANO, true)
378 assertVendorConstants('SOLANO', ci, t)
379
380 delete process.env.TDDIUM
381
382 t.end()
383 })
384
385 test('Travis CI - PR', function (t) {
386 process.env.TRAVIS = 'true'
387 process.env.TRAVIS_PULL_REQUEST = '42'
388
389 clearRequire('./')
390 var ci = require('./')
391
392 t.equal(ci.isCI, true)
393 t.equal(ci.isPR, true)
394 t.equal(ci.name, 'Travis CI')
395 t.equal(ci.TRAVIS, true)
396 assertVendorConstants('TRAVIS', ci, t)
397
398 delete process.env.TRAVIS
399 delete process.env.TRAVIS_PULL_REQUEST
400
401 t.end()
402 })
403
404 test('Travis CI - Not PR', function (t) {
405 process.env.TRAVIS = 'true'
406 process.env.TRAVIS_PULL_REQUEST = 'false'
407
408 clearRequire('./')
409 var ci = require('./')
410
411 t.equal(ci.isCI, true)
412 t.equal(ci.isPR, false)
413 t.equal(ci.name, 'Travis CI')
414 t.equal(ci.TRAVIS, true)
415 assertVendorConstants('TRAVIS', ci, t)
416
417 delete process.env.TRAVIS
418 delete process.env.TRAVIS_PULL_REQUEST
419
420 t.end()
421 })
422
423 test('Netlify CI - PR', function (t) {
424 process.env.NETLIFY_BUILD_BASE = '/opt/build'
425 process.env.PULL_REQUEST = 'true'
426
427 clearRequire('./')
428 var ci = require('./')
429
430 t.equal(ci.isCI, true)
431 t.equal(ci.isPR, true)
432 t.equal(ci.name, 'Netlify CI')
433 t.equal(ci.NETLIFY, true)
434 assertVendorConstants('NETLIFY', ci, t)
435
436 delete process.env.NETLIFY_BUILD_BASE
437 delete process.env.PULL_REQUEST
438
439 t.end()
440 })
441
442 test('Netlify CI - Not PR', function (t) {
443 process.env.NETLIFY_BUILD_BASE = '/opt/build'
444 process.env.PULL_REQUEST = 'false'
445
446 clearRequire('./')
447 var ci = require('./')
448
449 t.equal(ci.isCI, true)
450 t.equal(ci.isPR, false)
451 t.equal(ci.name, 'Netlify CI')
452 t.equal(ci.NETLIFY, true)
453 assertVendorConstants('NETLIFY', ci, t)
454
455 delete process.env.NETLIFY_BUILD_BASE
456 delete process.env.PULL_REQUEST
457
458 t.end()
459 })
460
461 function assertVendorConstants (expect, ci, t) {
462 ci._vendors.forEach(function (constant) {
463 var bool = constant === expect
464 bool = (expect === 'SOLANO' && constant === 'TDDIUM') || bool // support deprecated option
465 t.equal(ci[constant], bool, 'ci.' + constant)
466 })
467 }
+0
-21
types-ci-info/LICENSE less more
0 MIT License
1
2 Copyright (c) Microsoft Corporation. All rights reserved.
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE
+0
-16
types-ci-info/README.md less more
0 # Installation
1 > `npm install --save @types/ci-info`
2
3 # Summary
4 This package contains type definitions for ci-info ( https://github.com/watson/ci-info ).
5
6 # Details
7 Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ci-info
8
9 Additional Details
10 * Last updated: Thu, 30 May 2019 19:18:07 GMT
11 * Dependencies: none
12 * Global values: none
13
14 # Credits
15 These definitions were written by Florian Keller <https://github.com/ffflorian>.
+0
-58
types-ci-info/index.d.ts less more
0 // Type definitions for ci-info 2.0
1 // Project: https://github.com/watson/ci-info
2 // Definitions by: Florian Keller <https://github.com/ffflorian>
3 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
4
5 /**
6 * Returns a boolean. Will be `true` if the code is running on a CI server,
7 * otherwise `false`.
8 *
9 * Some CI servers not listed here might still trigger the `ci.isCI`
10 * boolean to be set to `true` if they use certain vendor neutral environment
11 * variables. In those cases `ci.name` will be `null` and no vendor specific
12 * boolean will be set to `true`.
13 */
14 export const isCI: boolean;
15 /**
16 * Returns a boolean if PR detection is supported for the current CI server.
17 * Will be `true` if a PR is being tested, otherwise `false`. If PR detection is
18 * not supported for the current CI server, the value will be `null`.
19 */
20 export const isPR: boolean | null;
21 /**
22 * Returns a string containing name of the CI server the code is running on. If
23 * CI server is not detected, it returns `null`.
24 *
25 * Don't depend on the value of this string not to change for a specific vendor.
26 * If you find your self writing `ci.name === 'Travis CI'`, you most likely want
27 * to use `ci.TRAVIS` instead.
28 */
29 export const name: string | null;
30
31 export const APPVEYOR: boolean;
32 export const AZURE_PIPELINES: boolean;
33 export const BAMBOO: boolean;
34 export const BITBUCKET: boolean;
35 export const BITRISE: boolean;
36 export const BUDDY: boolean;
37 export const BUILDKITE: boolean;
38 export const CIRCLE: boolean;
39 export const CIRRUS: boolean;
40 export const CODEBUILD: boolean;
41 export const CODESHIP: boolean;
42 export const DRONE: boolean;
43 export const DSARI: boolean;
44 export const GITLAB: boolean;
45 export const GOCD: boolean;
46 export const HUDSON: boolean;
47 export const JENKINS: boolean;
48 export const MAGNUM: boolean;
49 export const NETLIFY: boolean;
50 export const SAIL: boolean;
51 export const SEMAPHORE: boolean;
52 export const SHIPPABLE: boolean;
53 export const SOLANO: boolean;
54 export const STRIDER: boolean;
55 export const TASKCLUSTER: boolean;
56 export const TEAMCITY: boolean;
57 export const TRAVIS: boolean;
+0
-24
types-ci-info/package.json less more
0 {
1 "name": "@types/ci-info",
2 "version": "2.0.0",
3 "description": "TypeScript definitions for ci-info",
4 "license": "MIT",
5 "contributors": [
6 {
7 "name": "Florian Keller",
8 "url": "https://github.com/ffflorian",
9 "githubUsername": "ffflorian"
10 }
11 ],
12 "main": "",
13 "types": "index",
14 "repository": {
15 "type": "git",
16 "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
17 "directory": "types/ci-info"
18 },
19 "scripts": {},
20 "dependencies": {},
21 "typesPublisherContentHash": "e6c493e61b2974ff40875edce1616a42e098b7792efea9c9e3eb433ccdecbaae",
22 "typeScriptVersion": "2.0"
23 }
1111 "pr": "SYSTEM_PULLREQUEST_PULLREQUESTID"
1212 },
1313 {
14 "name": "Appcircle",
15 "constant": "APPCIRCLE",
16 "env": "AC_APPCIRCLE"
17 },
18 {
1419 "name": "Bamboo",
1520 "constant": "BAMBOO",
1621 "env": "bamboo_planKey"
5762 "env": "CODEBUILD_BUILD_ARN"
5863 },
5964 {
65 "name": "Codefresh",
66 "constant": "CODEFRESH",
67 "env": "CF_BUILD_ID",
68 "pr": { "any": ["CF_PULL_REQUEST_NUMBER", "CF_PULL_REQUEST_ID"] }
69 },
70 {
6071 "name": "Codeship",
6172 "constant": "CODESHIP",
6273 "env": { "CI_NAME": "codeship" }
7384 "env": "DSARI"
7485 },
7586 {
87 "name": "GitHub Actions",
88 "constant": "GITHUB_ACTIONS",
89 "env": "GITHUB_ACTIONS",
90 "pr": { "GITHUB_EVENT_NAME": "pull_request" }
91 },
92 {
7693 "name": "GitLab CI",
7794 "constant": "GITLAB",
78 "env": "GITLAB_CI"
95 "env": "GITLAB_CI",
96 "pr": "CI_MERGE_REQUEST_ID"
7997 },
8098 {
8199 "name": "GoCD",
82100 "constant": "GOCD",
83101 "env": "GO_PIPELINE_LABEL"
102 },
103 {
104 "name": "LayerCI",
105 "constant": "LAYERCI",
106 "env": "LAYERCI",
107 "pr": "LAYERCI_PULL_REQUEST"
84108 },
85109 {
86110 "name": "Hudson",
101125 {
102126 "name": "Netlify CI",
103127 "constant": "NETLIFY",
104 "env": "NETLIFY_BUILD_BASE",
128 "env": "NETLIFY",
105129 "pr": { "env": "PULL_REQUEST", "ne": "false" }
130 },
131 {
132 "name": "Nevercode",
133 "constant": "NEVERCODE",
134 "env": "NEVERCODE",
135 "pr": { "env": "NEVERCODE_PULL_REQUEST", "ne": "false" }
136 },
137 {
138 "name": "Render",
139 "constant": "RENDER",
140 "env": "RENDER",
141 "pr": { "IS_PULL_REQUEST": "true" }
106142 },
107143 {
108144 "name": "Sail CI",
117153 "pr": "PULL_REQUEST_NUMBER"
118154 },
119155 {
156 "name": "Screwdriver",
157 "constant": "SCREWDRIVER",
158 "env": "SCREWDRIVER",
159 "pr": { "env": "SD_PULL_REQUEST", "ne": "false" }
160 },
161 {
120162 "name": "Shippable",
121163 "constant": "SHIPPABLE",
122164 "env": "SHIPPABLE",
148190 "constant": "TRAVIS",
149191 "env": "TRAVIS",
150192 "pr": { "env": "TRAVIS_PULL_REQUEST", "ne": "false" }
193 },
194 {
195 "name": "Vercel",
196 "constant": "VERCEL",
197 "env": "NOW_BUILDER"
198 },
199 {
200 "name": "Visual Studio App Center",
201 "constant": "APPCENTER",
202 "env": "APPCENTER_BUILD_ID"
151203 }
152204 ]