Improve code quality and write tests

This commit is contained in:
Shivam Mathur
2019-09-20 08:11:20 +05:30
parent db44db4b97
commit 43178a7254
3597 changed files with 255478 additions and 785554 deletions

563
node_modules/codecov/lib/codecov.js generated vendored Normal file
View File

@ -0,0 +1,563 @@
var fs = require('fs')
var path = require('path')
var request = require('teeny-request').teenyRequest
var urlgrey = require('urlgrey')
var jsYaml = require('js-yaml')
var walk = require('ignore-walk')
var execSync = require('child_process').execSync
var detectProvider = require('./detect')
var version = 'v' + require('../package.json').version
var patterns,
more_patterns = ''
var isWindows =
process.platform.match(/win32/) || process.platform.match(/win64/)
if (!isWindows) {
patterns =
"-type f \\( -name '*coverage.*' " +
"-or -name 'nosetests.xml' " +
"-or -name 'jacoco*.xml' " +
"-or -name 'clover.xml' " +
"-or -name 'report.xml' " +
"-or -name 'cobertura.xml' " +
"-or -name 'luacov.report.out' " +
"-or -name 'lcov.info' " +
"-or -name '*.lcov' " +
"-or -name 'gcov.info' " +
"-or -name '*.gcov' " +
"-or -name '*.lst' \\) " +
"-not -name '*.sh' " +
"-not -name '*.data' " +
"-not -name '*.py' " +
"-not -name '*.class' " +
"-not -name '*.xcconfig' " +
"-not -name 'Coverage.profdata' " +
"-not -name 'phpunit-code-coverage.xml' " +
"-not -name 'coverage.serialized' " +
"-not -name '*.pyc' " +
"-not -name '*.cfg' " +
"-not -name '*.egg' " +
"-not -name '*.whl' " +
"-not -name '*.html' " +
"-not -name '*.js' " +
"-not -name '*.cpp' " +
"-not -name 'coverage.jade' " +
"-not -name 'include.lst' " +
"-not -name 'inputFiles.lst' " +
"-not -name 'createdFiles.lst' " +
"-not -name 'coverage.html' " +
"-not -name 'scoverage.measurements.*' " +
"-not -name 'test_*_coverage.txt' " +
"-not -path '*/vendor/*' " +
"-not -path '*/htmlcov/*' " +
"-not -path '*/home/cainus/*' " +
"-not -path '*/virtualenv/*' " +
"-not -path '*/js/generated/coverage/*' " +
"-not -path '*/.virtualenv/*' " +
"-not -path '*/virtualenvs/*' " +
"-not -path '*/.virtualenvs/*' " +
"-not -path '*/.env/*' " +
"-not -path '*/.envs/*' " +
"-not -path '*/env/*' " +
"-not -path '*/envs/*' " +
"-not -path '*/.venv/*' " +
"-not -path '*/.venvs/*' " +
"-not -path '*/venv/*' " +
"-not -path '*/venvs/*' " +
"-not -path '*/.git/*' " +
"-not -path '*/.hg/*' " +
"-not -path '*/.tox/*' " +
"-not -path '*/__pycache__/*' " +
"-not -path '*/.egg-info*' " +
"-not -path '*/$bower_components/*' " +
"-not -path '*/node_modules/*' " +
"-not -path '*/conftest_*.c.gcov'"
} else {
patterns =
'/a-d /b /s *coverage.* ' +
'/s nosetests.xml ' +
'/s jacoco*.xml ' +
'/s clover.xml ' +
'/s report.xml ' +
'/s cobertura.xml ' +
'/s luacov.report.out ' +
'/s lcov.info ' +
'/s *.lcov ' +
'/s gcov.info ' +
'/s *.gcov ' +
'/s *.lst' +
'| findstr /i /v \\.sh$ ' +
'| findstr /i /v \\.data$ ' +
'| findstr /i /v \\.py$ ' +
'| findstr /i /v \\.class$ ' +
'| findstr /i /v \\.xcconfig$ ' +
'| findstr /i /v Coverage\\.profdata$ ' +
'| findstr /i /v phpunit-code-coverage\\.xml$ ' +
'| findstr /i /v coverage\\.serialized$ ' +
'| findstr /i /v \\.pyc$ ' +
'| findstr /i /v \\.cfg$ ' +
'| findstr /i /v \\.egg$ ' +
'| findstr /i /v \\.whl$ ' +
'| findstr /i /v \\.html$ ' +
'| findstr /i /v \\.js$ ' +
'| findstr /i /v \\.cpp$ ' +
'| findstr /i /v coverage\\.jade$ ' +
'| findstr /i /v include\\.lst$ ' +
'| findstr /i /v inputFiles\\.lst$ ' +
'| findstr /i /v createdFiles\\.lst$ ' +
'| findstr /i /v coverage\\.html$ ' +
'| findstr /i /v scoverage\\.measurements\\..* ' +
'| findstr /i /v test_.*_coverage\\.txt ' +
'| findstr /i /v \\vendor\\ ' +
'| findstr /i /v \\htmlcov\\ ' +
'| findstr /i /v \\home\\cainus\\ ' +
'| findstr /i /v \\js\\generated\\coverage\\ ' +
'| findstr /i /v \\virtualenv\\ ' +
'| findstr /i /v \\virtualenvs\\ ' +
'| findstr /i /v \\\\.virtualenv\\ ' +
'| findstr /i /v \\\\.virtualenvs\\ ' +
'| findstr /i /v \\\\.env\\ ' +
'| findstr /i /v \\\\.envs\\ ' +
'| findstr /i /v \\env\\ ' +
'| findstr /i /v \\envs\\ ' +
'| findstr /i /v \\\\.venv\\ ' +
'| findstr /i /v \\\\.venvs\\ ' +
'| findstr /i /v \\venv\\ ' +
'| findstr /i /v \\venvs\\ ' +
'| findstr /i /v \\\\.git\\ ' +
'| findstr /i /v \\\\.hg\\ ' +
'| findstr /i /v \\\\.tox\\ ' +
'| findstr /i /v \\__pycache__\\ ' +
'| findstr /i /v \\\\.egg-info* ' +
'| findstr /i /v \\\\$bower_components\\ ' +
'| findstr /i /v \\node_modules\\ ' +
'| findstr /i /v \\conftest_.*\\.c\\.gcov '
}
var sendToCodecovV2 = function(
codecov_endpoint,
query,
upload_body,
on_success,
on_failure
) {
// Direct to Codecov
request(
{
uri: urlgrey(codecov_endpoint + '/upload/v2')
.query(query)
.toString(),
method: 'POST',
body: upload_body,
headers: {
'Content-Type': 'text/plain',
Accept: 'text/plain',
},
},
function(err, response) {
if (err || response.statusCode !== 200) {
console.log(' ' + (err || response.body))
return response
? on_failure(response.statusCode, response.body)
: on_failure(err.code, err.message)
} else {
console.log(' Success!')
console.log(' View report at: ' + response.body)
return on_success(response.body)
}
}
)
}
var sendToCodecovV3 = function(
codecov_endpoint,
query,
upload_body,
on_success,
on_failure
) {
// Direct to S3
request(
{
uri: urlgrey(codecov_endpoint + '/upload/v4')
.query(query)
.toString(),
method: 'POST',
body: '',
headers: {
'Content-Type': 'text/plain',
Accept: 'text/plain',
},
},
function(err, response, result) {
if (err) {
sendToCodecovV2(
codecov_endpoint,
query,
upload_body,
on_success,
on_failure
)
} else {
var codecov_report_url = result.split('\n')[0]
request(
{
uri: result.split('\n')[1],
method: 'PUT',
body: upload_body,
headers: {
'Content-Type': 'text/plain',
'x-amz-acl': 'public-read',
},
},
function(err) {
if (err) {
sendToCodecovV2(
codecov_endpoint,
query,
upload_body,
on_success,
on_failure
)
} else {
console.log(' Success!')
console.log(' View report at: ' + codecov_report_url)
on_success(codecov_report_url)
}
}
)
}
}
)
}
var upload = function(args, on_success, on_failure) {
// Build query
var codecov_endpoint =
args.options.url ||
process.env.codecov_url ||
process.env.CODECOV_URL ||
'https://codecov.io'
var query = {}
var debug = []
var yamlFile =
args.options.yml ||
process.env.codecov_yml ||
process.env.CODECOV_YML ||
'codecov.yml'
console.log(
'' +
' _____ _ \n' +
' / ____| | | \n' +
'| | ___ __| | ___ ___ _____ __ \n' +
'| | / _ \\ / _` |/ _ \\/ __/ _ \\ \\ / / \n' +
'| |___| (_) | (_| | __/ (_| (_) \\ V / \n' +
' \\_____\\___/ \\__,_|\\___|\\___\\___/ \\_/ \n' +
' ' +
version
)
if ((args.options.disable || '').split(',').indexOf('detect') === -1) {
console.log('==> Detecting CI Provider')
query = detectProvider()
} else {
debug.push('disabled detect')
}
query.yaml = [yamlFile, '.codecov.yml'].reduce(function(result, file) {
return (
result ||
(fs.existsSync(path.resolve(process.cwd(), file))
? path.resolve(process.cwd(), file)
: undefined)
)
}, undefined)
if (args.options.build) {
query.build = args.options.build
}
if (args.options.commit) {
query.commit = args.options.commit
}
if (args.options.branch) {
query.branch = args.options.branch
}
if (args.options.slug) {
query.slug = args.options.slug
}
var flags =
args.options.flags || process.env.codecov_flags || process.env.CODECOV_FLAGS
if (flags) {
query.flags = flags
}
var yamlToken
try {
var loadedYamlFile = jsYaml.safeLoad(fs.readFileSync(query.yaml, 'utf8'))
yamlToken =
loadedYamlFile && loadedYamlFile.codecov && loadedYamlFile.codecov.token
} catch (e) {
// silently fail
}
var token =
args.options.token ||
yamlToken ||
process.env.codecov_token ||
process.env.CODECOV_TOKEN
if (token) {
query.token = token
}
query.package = 'node-' + version
console.log('==> Configuration: ')
console.log(' Endpoint: ' + codecov_endpoint)
// Don't output `query` directly as it contains the upload token
console.log({
commit: query.commit,
branch: query.branch,
package: query.package,
})
var upload = ''
// Add specified env vars
var env_found = false
if (args.options.env || process.env.CODECOV_ENV || process.env.codecov_env) {
var env = (
args.options.env +
',' +
(process.env.CODECOV_ENV || '') +
',' +
(process.env.codecov_env || '')
).split(',')
for (var i = env.length - 1; i >= 0; i--) {
if (env[i]) {
upload += env[i] + '=' + (process.env[env[i]] || '').toString() + '\n'
env_found = true
}
}
if (env_found) {
upload += '<<<<<< ENV\n'
}
}
// List git files
var root = path.resolve(args.options.root || query.root || '.')
console.log('==> Building file structure')
try {
upload +=
execSync('git ls-files || hg locate', { cwd: root })
.toString()
.trim() + '\n<<<<<< network\n'
} catch (err) {
// not a git/hg dir, emulating git/hg ignore behavior
upload +=
walk
.sync({ path: root, ignoreFiles: ['.gitignore', '.hgignore'] })
.join('\n')
.trim() + '\n<<<<<< network\n'
}
// Make gcov reports
if ((args.options.disable || '').split(',').indexOf('gcov') === -1) {
try {
console.log('==> Generating gcov reports (skip via --disable=gcov)')
var gcg = args.options['gcov-glob'] || ''
if (gcg) {
if (!isWindows) {
gcg = gcg
.split(' ')
.map(function(p) {
return "-not -path '" + p + "'"
})
.join(' ')
} else {
gcg = gcg
.split(' ')
.map(function(p) {
return '^| findstr /i /v ' + p
})
.join(' ')
}
}
var gcov
if (!isWindows) {
gcov =
'find ' +
(args.options['gcov-root'] || root) +
" -type f -name '*.gcno' " +
gcg +
' -exec ' +
(args.options['gcov-exec'] || 'gcov') +
' ' +
(args.options['gcov-args'] || '') +
' {} +'
} else {
// @TODO support for root
// not straight forward due to nature of windows command dir
gcov =
'for /f "delims=" %g in (\'dir /a-d /b /s *.gcno ' +
gcg +
"') do " +
(args.options['gcov-exec'] || 'gcov') +
' ' +
(args.options['gcov-args'] || '') +
' %g'
}
debug.push(gcov)
console.log(' $ ' + gcov)
execSync(gcov)
} catch (e) {
console.log(' Failed to run gcov command.')
}
} else {
debug.push('disabled gcov')
}
// Detect .bowerrc
var bowerrc
if (!isWindows) {
bowerrc = execSync('test -f .bowerrc && cat .bowerrc || echo ""', {
cwd: root,
})
.toString()
.trim()
} else {
bowerrc = execSync('if exist .bowerrc type .bowerrc', { cwd: root })
.toString()
.trim()
}
if (bowerrc) {
bowerrc = JSON.parse(bowerrc).directory
if (bowerrc) {
if (!isWindows) {
more_patterns =
" -not -path '*/" + bowerrc.toString().replace(/\/$/, '') + "/*'"
} else {
more_patterns =
'| findstr /i /v \\' + bowerrc.toString().replace(/\/$/, '') + '\\'
}
}
}
var files = [],
file = null
if (args.options.pipe) {
// Append piped reports
upload += '# path=piped\n' + args.options.pipe.join('') + '\n<<<<<< EOF\n'
console.log('==> Reading report from stdin')
} else if (args.options.file) {
// Append manually entered reports
file = args.options.file
console.log('==> Targeting specific file')
try {
upload +=
'# path=' +
file +
'\n' +
fs.readFileSync(file, 'utf8').toString() +
'\n<<<<<< EOF\n'
console.log(' + ' + file)
files.push(file)
} catch (e) {
debug.push('failed: ' + file.split('/').pop())
console.log(' X Failed to read file at ' + file)
}
} else if ((args.options.disable || '').split(',').indexOf('search') === -1) {
console.log('==> Scanning for reports')
var _files
if (!isWindows) {
_files = execSync('find ' + root + ' ' + patterns + more_patterns)
.toString()
.trim()
.split('\n')
} else {
// @TODO support for a root directory
// It's not straightforward due to the nature of the dir command
_files = execSync('dir ' + patterns + more_patterns)
.toString()
.trim()
.split('\r\n')
}
if (_files) {
for (var i2 = _files.length - 1; i2 >= 0; i2--) {
file = _files[i2]
try {
upload +=
'# path=' +
file +
'\n' +
fs.readFileSync(file, 'utf8').toString() +
'\n<<<<<< EOF\n'
console.log(' + ' + file)
files.push(file)
} catch (e) {
debug.push('failed: ' + file.split('/').pop())
console.log(' X Failed to read file at ' + file)
}
}
}
} else {
debug.push('disabled search')
}
if (files) {
// Upload to Codecov
if (args.options.dump) {
console.log('-------- DEBUG START --------')
console.log(upload)
console.log('-------- DEBUG END --------')
} else {
console.log('==> Uploading reports')
var _upload
if ((args.options.disable || '').split(',').indexOf('s3') === -1) {
_upload = sendToCodecovV3
} else {
_upload = sendToCodecovV2
}
_upload(
codecov_endpoint,
query,
upload,
function() {
// remove files after Uploading
if (args.options.clear) {
for (var i = files.length - 1; i >= 0; i--) {
try {
fs.unlinkSync(files[i])
} catch (e) {}
}
}
if (on_success) {
on_success.apply(this, arguments)
}
},
on_failure || function() {}
)
}
}
return {
body: upload,
files: files,
query: query,
debug: debug,
url: codecov_endpoint,
}
}
module.exports = {
upload: upload,
version: version,
sendToCodecovV2: sendToCodecovV2,
sendToCodecovV3: sendToCodecovV3,
}

39
node_modules/codecov/lib/detect.js generated vendored Normal file
View File

@ -0,0 +1,39 @@
var services = {
travis: require('./services/travis'),
circle: require('./services/circle'),
cirrus: require('./services/cirrus'),
buildkite: require('./services/buildkite'),
azurePipelines: require('./services/azurePipelines'),
codeship: require('./services/codeship'),
drone: require('./services/drone'),
appveyor: require('./services/appveyor'),
wercker: require('./services/wercker'),
jenkins: require('./services/jenkins'),
semaphore: require('./services/semaphore'),
semaphore2x: require('./services/semaphore2x'),
snap: require('./services/snap'),
gitlab: require('./services/gitlab'),
heroku: require('./services/heroku'),
teamcity: require('./services/teamcity'),
codebuild: require('./services/codebuild'),
}
var detectProvider = function() {
var config
for (var name in services) {
if (services[name].detect()) {
config = services[name].configuration()
break
}
}
if (!config) {
var local = require('./services/localGit')
config = local.configuration()
if (!config) {
throw new Error('Unknown CI service provider. Unable to upload coverage.')
}
}
return config
}
module.exports = detectProvider

15
node_modules/codecov/lib/git.js generated vendored Normal file
View File

@ -0,0 +1,15 @@
var execSync = require('child_process').execSync
module.exports = {
branch: function() {
return execSync('git rev-parse --abbrev-ref HEAD || hg branch')
.toString()
.trim()
},
head: function() {
return execSync("git log -1 --pretty=%H || hg id -i --debug | tr -d '+'")
.toString()
.trim()
},
}

14
node_modules/codecov/lib/offline.js generated vendored Normal file
View File

@ -0,0 +1,14 @@
// see: http://man7.org/linux/man-pages/man2/accept.2.html#ERRORS
var offlineErrorCodes = [
'EAI_AGAIN',
'ENETDOWN',
'EPROTO',
'ENOPROTOOPT',
'EHOSTDOWN',
'ENONET',
'EHOSTUNREACH',
'EOPNOTSUPP',
'ENETUNREACH',
]
module.exports = offlineErrorCodes

23
node_modules/codecov/lib/services/appveyor.js generated vendored Normal file
View File

@ -0,0 +1,23 @@
module.exports = {
detect: function() {
return !!process.env.APPVEYOR
},
configuration: function() {
console.log(' AppVeyor CI Detected')
return {
service: 'appveyor',
commit: process.env.APPVEYOR_REPO_COMMIT,
branch: process.env.APPVEYOR_REPO_BRANCH,
pr: process.env.APPVEYOR_PULL_REQUEST_NUMBER,
job:
process.env.APPVEYOR_ACCOUNT_NAME +
'/' +
process.env.APPVEYOR_PROJECT_SLUG +
'/' +
process.env.APPVEYOR_BUILD_VERSION,
build: process.env.APPVEYOR_JOB_ID,
slug: process.env.APPVEYOR_REPO_NAME,
}
},
}

23
node_modules/codecov/lib/services/azurePipelines.js generated vendored Normal file
View File

@ -0,0 +1,23 @@
module.exports = {
detect: function() {
return !!process.env.TF_BUILD
},
configuration: function() {
console.log(' Azure Pipelines CI Detected')
return {
service: 'azure_pipelines',
commit: process.env.BUILD_SOURCEVERSION,
branch: process.env.BUILD_SOURCEBRANCH,
pr: process.env.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER,
job: process.env.SYSTEM_JOBID,
build: process.env.BUILD_BUILDID,
build_url:
process.env.SYSTEM_TEAMFOUNDATIONSERVERURI +
process.env.SYSTEM_TEAMPROJECT +
'/_build/results?buildId=' +
process.env.BUILD_BUILDID,
slug: process.env.BUILD_REPOSITORY_ID,
}
},
}

18
node_modules/codecov/lib/services/buildkite.js generated vendored Normal file
View File

@ -0,0 +1,18 @@
module.exports = {
detect: function() {
return !!process.env.BUILDKITE
},
configuration: function() {
// https://buildkite.com/docs/guides/environment-variables
console.log(' Buildkite CI Detected')
return {
service: 'buildkite',
build: process.env.BUILDKITE_BUILD_NUMBER,
build_url: process.env.BUILDKITE_BUILD_URL,
commit: process.env.BUILDKITE_COMMIT,
branch: process.env.BUILDKITE_BRANCH,
slug: process.env.BUILDKITE_PROJECT_SLUG,
}
},
}

40
node_modules/codecov/lib/services/circle.js generated vendored Normal file
View File

@ -0,0 +1,40 @@
module.exports = {
detect: function() {
return !!process.env.CIRCLECI
},
configuration: function() {
console.log(' Circle CI Detected')
return {
service: 'circleci',
build: process.env.CIRCLE_BUILD_NUM + '.' + process.env.CIRCLE_NODE_INDEX,
job: process.env.CIRCLE_BUILD_NUM + '.' + process.env.CIRCLE_NODE_INDEX,
commit: process.env.CIRCLE_SHA1,
branch: process.env.CIRCLE_BRANCH,
pr: process.env.CIRCLE_PR_NUMBER,
slug: detectRepoSlug(),
}
function detectRepoSlug() {
if (process.env.CIRCLE_PROJECT_REPONAME) {
// CircleCI 1.0
// CIRCLE_PROJECT_REPONAME=codecov
// CIRCLE_PROJECT_USERNAME=codecov-node
// CIRCLE_REPOSITORY_URL=https://github.com/codecov/codecov-node (note: GitHub Web URL)
return (
process.env.CIRCLE_PROJECT_USERNAME +
'/' +
process.env.CIRCLE_PROJECT_REPONAME
)
}
if (process.env.CIRCLE_REPOSITORY_URL) {
// CircleCI 2.0
// CIRCLE_REPOSITORY_URL=git@github.com:codecov/codecov-node.git (note: Git/SSH URL)
return process.env.CIRCLE_REPOSITORY_URL.replace(/^.*:/, '').replace(
/\.git$/,
''
)
}
throw new Error('Cannot detect repository slug.')
}
},
}

17
node_modules/codecov/lib/services/cirrus.js generated vendored Normal file
View File

@ -0,0 +1,17 @@
module.exports = {
detect: function() {
return !!process.env.CIRRUS_CI
},
configuration: function() {
console.log(' Cirrus CI Detected')
return {
service: 'cirrusci',
build: process.env.CIRRUS_BUILD_ID,
job: process.env.CIRRUS_TASK_ID,
commit: process.env.CIRRUS_CHANGE_IN_REPO,
branch: process.env.CIRRUS_BRANCH,
pr: process.env.CIRRUS_PR,
slug: process.env.CIRRUS_REPO_FULL_NAME,
}
},
}

42
node_modules/codecov/lib/services/codebuild.js generated vendored Normal file
View File

@ -0,0 +1,42 @@
module.exports = {
detect: function() {
return !!process.env.CODEBUILD_CI
},
configuration: function() {
console.log(' AWS CodeBuild Detected')
return {
service: 'codebuild',
build: process.env.CODEBUILD_BUILD_ID,
job: process.env.CODEBUILD_BUILD_ID,
commit: process.env.CODEBUILD_RESOLVED_SOURCE_VERSION,
branch: detectBranchName(),
pr: detectPRNumber(),
slug: detectRepoSlug(),
}
function detectBranchName() {
if (process.env.CODEBUILD_WEBHOOK_HEAD_REF) {
return process.env.CODEBUILD_WEBHOOK_HEAD_REF.replace(
/^refs\/heads\//,
''
)
}
throw new Error('Cannot detect branch name.')
}
function detectPRNumber() {
if (process.env.CODEBUILD_SOURCE_VERSION) {
return process.env.CODEBUILD_SOURCE_VERSION.replace(/^pr\//, '')
}
throw new Error('Cannot detect PR number.')
}
function detectRepoSlug() {
if (process.env.CODEBUILD_SOURCE_REPO_URL) {
return process.env.CODEBUILD_SOURCE_REPO_URL.replace(
/^.*github.com\//,
''
).replace(/\.git$/, '')
}
throw new Error('Cannot detect repository slug.')
}
},
}

16
node_modules/codecov/lib/services/codeship.js generated vendored Normal file
View File

@ -0,0 +1,16 @@
module.exports = {
detect: function() {
return process.env.CI_NAME && process.env.CI_NAME === 'codeship'
},
configuration: function() {
console.log(' Codeship CI Detected')
return {
service: 'codeship',
build: process.env.CI_BUILD_NUMBER,
build_url: process.env.CI_BUILD_URL,
commit: process.env.CI_COMMIT_ID,
branch: process.env.CI_BRANCH,
}
},
}

19
node_modules/codecov/lib/services/drone.js generated vendored Normal file
View File

@ -0,0 +1,19 @@
var git = require('../git')
module.exports = {
detect: function() {
return !!process.env.DRONE
},
configuration: function() {
console.log(' Drone.io CI Detected')
return {
service: 'drone.io',
build: process.env.DRONE_BUILD_NUMBER,
commit: git.head(),
build_url: process.env.DRONE_BUILD_URL,
branch: process.env.DRONE_BRANCH,
root: process.env.DRONE_BUILD_DIR,
}
},
}

25
node_modules/codecov/lib/services/gitlab.js generated vendored Normal file
View File

@ -0,0 +1,25 @@
// https://docs.gitlab.com/ce/ci/variables/README.html
module.exports = {
detect: function() {
return !!process.env.GITLAB_CI
},
configuration: function() {
console.log(' Gitlab CI Detected')
var remote =
process.env.CI_BUILD_REPO || process.env.CI_REPOSITORY_URL || ''
return {
service: 'gitlab',
build: process.env.CI_BUILD_ID,
commit: process.env.CI_BUILD_REF,
branch: process.env.CI_BUILD_REF_NAME,
root: process.env.CI_PROJECT_DIR,
slug: remote
.split('/')
.slice(3, 5)
.join('/')
.replace('.git', ''),
}
},
}

17
node_modules/codecov/lib/services/heroku.js generated vendored Normal file
View File

@ -0,0 +1,17 @@
// https://devcenter.heroku.com/articles/heroku-ci
module.exports = {
detect: function() {
return !!process.env.HEROKU_TEST_RUN_ID
},
configuration: function() {
console.log(' heroku CI Detected')
return {
service: 'heroku',
build: process.env.HEROKU_TEST_RUN_ID,
commit: process.env.HEROKU_TEST_RUN_COMMIT_VERSION,
branch: process.env.HEROKU_TEST_RUN_BRANCH,
}
},
}

24
node_modules/codecov/lib/services/jenkins.js generated vendored Normal file
View File

@ -0,0 +1,24 @@
var git = require('../git')
module.exports = {
detect: function() {
return !!process.env.JENKINS_URL
},
configuration: function() {
console.log(' Jenkins CI Detected')
return {
service: 'jenkins',
commit:
process.env.ghprbActualCommit || process.env.GIT_COMMIT || git.head(),
branch:
process.env.ghprbSourceBranch ||
process.env.GIT_BRANCH ||
process.env.BRANCH_NAME,
build: process.env.BUILD_NUMBER,
build_url: process.env.BUILD_URL,
root: process.env.WORKSPACE,
pr: process.env.ghprbPullId || process.env.CHANGE_ID,
}
},
}

16
node_modules/codecov/lib/services/localGit.js generated vendored Normal file
View File

@ -0,0 +1,16 @@
var git = require('../git')
module.exports = {
configuration: function() {
console.log(' No CI Detected. Using git/mercurial')
var branch = git.branch()
if (branch === 'HEAD') {
branch = 'master'
}
var head = git.head()
return {
commit: head,
branch: branch,
}
},
}

19
node_modules/codecov/lib/services/semaphore.js generated vendored Normal file
View File

@ -0,0 +1,19 @@
module.exports = {
detect: function() {
return !!process.env.SEMAPHORE && !!process.env.SEMAPHORE_REPO_SLUG
},
configuration: function() {
console.log(' Semaphore 1.x CI Detected')
return {
service: 'semaphore1x',
build:
process.env.SEMAPHORE_BUILD_NUMBER +
'.' +
process.env.SEMAPHORE_CURRENT_THREAD,
commit: process.env.REVISION,
branch: process.env.BRANCH_NAME,
slug: process.env.SEMAPHORE_REPO_SLUG,
}
},
}

15
node_modules/codecov/lib/services/semaphore2x.js generated vendored Normal file
View File

@ -0,0 +1,15 @@
module.exports = {
detect: function() {
return !!process.env.SEMAPHORE && !!process.env.SEMAPHORE_WORKFLOW_ID
},
configuration: function() {
console.log(' Semaphore 2.x CI Detected')
return {
service: 'semaphore2x',
branch: process.env.SEMAPHORE_GIT_BRANCH,
build: process.env.SEMAPHORE_WORKFLOW_ID,
commit: process.env.SEMAPHORE_GIT_SHA,
}
},
}

19
node_modules/codecov/lib/services/shippable.js generated vendored Normal file
View File

@ -0,0 +1,19 @@
module.exports = {
detect: function() {
return !!process.env.SHIPPABLE
},
configuration: function() {
// http://docs.shippable.com/en/latest/config.html#common-environment-variables
console.log(' Shippable CI Detected')
return {
service: 'shippable',
build: process.env.BUILD_NUMBER,
build_url: process.env.BUILD_URL,
pr: process.env.PULL_REQUEST,
commit: process.env.COMMIT,
branch: process.env.BRANCH,
slug: process.env.REPO_NAME,
}
},
}

16
node_modules/codecov/lib/services/snap.js generated vendored Normal file
View File

@ -0,0 +1,16 @@
module.exports = {
detect: function() {
return !!process.env.SNAP_CI
},
configuration: function() {
console.log(' Snap CI Detected')
return {
service: 'snap',
build: process.env.SNAP_PIPELINE_COUNTER,
commit: process.env.SNAP_COMMIT || process.env.SNAP_UPSTREAM_COMMIT,
branch: process.env.SNAP_BRANCH || process.env.SNAP_UPSTREAM_BRANCH,
pr: process.env.SNAP_PULL_REQUEST_NUMBER,
}
},
}

17
node_modules/codecov/lib/services/teamcity.js generated vendored Normal file
View File

@ -0,0 +1,17 @@
module.exports = {
detect: function () {
return !!process.env.TEAMCITY_VERSION;
},
configuration: function () {
console.log(' TeamCity CI Detected');
return {
service: 'teamcity',
commit: process.env.BUILD_VCS_NUMBER,
branch: process.env.BRANCH_NAME,
build: process.env.BUILD_NUMBER
};
}
};

19
node_modules/codecov/lib/services/travis.js generated vendored Normal file
View File

@ -0,0 +1,19 @@
module.exports = {
detect: function() {
return !!process.env.TRAVIS
},
configuration: function() {
console.log(' Travis CI Detected')
return {
service: 'travis',
commit: process.env.TRAVIS_COMMIT,
build: process.env.TRAVIS_JOB_NUMBER,
branch: process.env.TRAVIS_BRANCH,
job: process.env.TRAVIS_JOB_ID,
pr: process.env.TRAVIS_PULL_REQUEST,
slug: process.env.TRAVIS_REPO_SLUG,
root: process.env.TRAVIS_BUILD_DIR,
}
},
}

22
node_modules/codecov/lib/services/wercker.js generated vendored Normal file
View File

@ -0,0 +1,22 @@
// http://devcenter.wercker.com/articles/steps/variables.html
module.exports = {
detect: function() {
return !!process.env.WERCKER_MAIN_PIPELINE_STARTED
},
configuration: function() {
console.log(' Wercker CI Detected')
return {
service: 'wercker',
build: process.env.WERCKER_MAIN_PIPELINE_STARTED,
commit: process.env.WERCKER_GIT_COMMIT,
build_url: process.env.WERCKER_BUILD_URL,
branch: process.env.WERCKER_GIT_BRANCH,
slug:
process.env.WERCKER_GIT_OWNER +
'/' +
process.env.WERCKER_GIT_REPOSITORY,
}
},
}