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

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,
}
},
}