mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-09-07 21:34:08 +07:00
Improve code quality and write tests
This commit is contained in:
17
node_modules/codecov/test/detect.test.js
generated
vendored
Normal file
17
node_modules/codecov/test/detect.test.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
var detect = require('../lib/detect')
|
||||
var git = require('../lib/git')
|
||||
|
||||
describe('Codecov', function() {
|
||||
it('can detect existing appveyor service', function() {
|
||||
process.env.TRAVIS = 'true'
|
||||
|
||||
expect(detect().service).toBe('travis')
|
||||
|
||||
process.env.TRAVIS = ''
|
||||
})
|
||||
|
||||
it('can select local git service if no service is found', function() {
|
||||
expect(detect().commit).toMatch(/^\w{40}$/)
|
||||
expect(detect().commit).toBe(git.head())
|
||||
})
|
||||
})
|
1
node_modules/codecov/test/example.coverage.txt
generated
vendored
Normal file
1
node_modules/codecov/test/example.coverage.txt
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
this file is intentionally left blank
|
20
node_modules/codecov/test/git.test.js
generated
vendored
Normal file
20
node_modules/codecov/test/git.test.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
var git = require('../lib/git')
|
||||
var execSync = require('child_process').execSync
|
||||
|
||||
describe('Git', function() {
|
||||
it('can get the branch', function() {
|
||||
expect(git.branch()).toEqual(
|
||||
execSync('git rev-parse --abbrev-ref HEAD || hg branch')
|
||||
.toString()
|
||||
.trim()
|
||||
)
|
||||
})
|
||||
|
||||
it('can get the head', function() {
|
||||
expect(git.head()).toEqual(
|
||||
execSync("git log -1 --pretty=%H || hg id -i --debug | tr -d '+'")
|
||||
.toString()
|
||||
.trim()
|
||||
)
|
||||
})
|
||||
})
|
279
node_modules/codecov/test/index.test.js
generated
vendored
Normal file
279
node_modules/codecov/test/index.test.js
generated
vendored
Normal file
@ -0,0 +1,279 @@
|
||||
var fs = require('fs')
|
||||
var mockFs = require('mock-fs')
|
||||
var codecov = require('../lib/codecov')
|
||||
|
||||
var isWindows =
|
||||
process.platform.match(/win32/) || process.platform.match(/win64/)
|
||||
var pathSeparator = !isWindows ? '/' : '\\'
|
||||
|
||||
describe('Codecov', function() {
|
||||
beforeEach(function() {
|
||||
try {
|
||||
fs.unlinkSync('.bowerrc')
|
||||
} catch (e) {}
|
||||
})
|
||||
|
||||
afterAll(function() {
|
||||
try {
|
||||
fs.unlinkSync('.bowerrc')
|
||||
} catch (e) {}
|
||||
})
|
||||
|
||||
it('can get a token passed via env variable', function() {
|
||||
jest.setTimeout(10000)
|
||||
process.env.codecov_token = 'abc123'
|
||||
expect(codecov.upload({ options: { dump: true } }).query.token).toBe(
|
||||
'abc123'
|
||||
)
|
||||
delete process.env.codecov_token
|
||||
process.env.CODECOV_TOKEN = 'ABC123'
|
||||
expect(codecov.upload({ options: { dump: true } }).query.token).toBe(
|
||||
'ABC123'
|
||||
)
|
||||
delete process.env.CODECOV_TOKEN
|
||||
})
|
||||
|
||||
it('can get a token passed in cli', function() {
|
||||
expect(
|
||||
codecov.upload({ options: { dump: true, token: 'qwerty' } }).query.token
|
||||
).toBe('qwerty')
|
||||
})
|
||||
|
||||
it('can read a codecov.yml file', function() {
|
||||
mockFs({
|
||||
'codecov.yml': 'codecov:\n token: fake-token',
|
||||
})
|
||||
expect(codecov.upload({ options: { dump: true } }).query.token).toBe(
|
||||
'fake-token'
|
||||
)
|
||||
mockFs.restore()
|
||||
})
|
||||
it('can read a .codecov.yml file', function() {
|
||||
mockFs({
|
||||
'.codecov.yml': 'codecov:\n token: fake-token-dotfile',
|
||||
})
|
||||
expect(codecov.upload({ options: { dump: true } }).query.token).toBe(
|
||||
'fake-token-dotfile'
|
||||
)
|
||||
mockFs.restore()
|
||||
})
|
||||
it('should have no token if yaml file does not supplied', function() {
|
||||
mockFs({
|
||||
'.codecov.yml': 'codecov:\n noconfig: true',
|
||||
})
|
||||
expect(codecov.upload({ options: { dump: true } }).query.token).toBe(
|
||||
undefined
|
||||
)
|
||||
mockFs.restore()
|
||||
})
|
||||
|
||||
it('token precedence should be respected', function() {
|
||||
// options.token || .codecov.yml/codecov.yml file || codecov_token || CODECOV_TOKEN
|
||||
mockFs({
|
||||
'.codecov.yml': 'codecov:\n token: fake-token-dotfile',
|
||||
})
|
||||
var upload = codecov.upload({ options: { dump: true, token: 'qwerty' } })
|
||||
expect(upload.query.token).toBe('qwerty')
|
||||
mockFs.restore()
|
||||
|
||||
process.env.codecov_token = 'abc123'
|
||||
upload = codecov.upload({ options: { dump: true, token: 'qwerty2' } })
|
||||
expect(upload.query.token).toBe('qwerty2')
|
||||
delete process.env.codecov_token
|
||||
|
||||
process.env.CODECOV_TOKEN = 'ABC123'
|
||||
upload = codecov.upload({ options: { dump: true, token: 'qwerty3' } })
|
||||
expect(upload.query.token).toBe('qwerty3')
|
||||
delete process.env.CODECOV_TOKEN
|
||||
|
||||
mockFs({
|
||||
'.codecov.yml': 'codecov:\n token: fake-token-dotfile',
|
||||
})
|
||||
process.env.codecov_token = 'abc123'
|
||||
upload = codecov.upload({ options: { dump: true } })
|
||||
expect(upload.query.token).toBe('fake-token-dotfile')
|
||||
mockFs.restore()
|
||||
|
||||
process.env.codecov_token = 'abc123'
|
||||
process.env.CODECOV_TOKEN = 'ABC123'
|
||||
upload = codecov.upload({ options: { dump: true } })
|
||||
expect(upload.query.token).toBe('abc123')
|
||||
delete process.env.codecov_token
|
||||
delete process.env.CODECOV_TOKEN
|
||||
})
|
||||
|
||||
it('can auto detect reports', function() {
|
||||
var res = codecov.upload({ options: { dump: true } })
|
||||
expect(res.files[0].split(pathSeparator).pop()).toBe('example.coverage.txt')
|
||||
expect(res.body).toContain('this file is intentionally left blank')
|
||||
})
|
||||
|
||||
it('can specify report in cli', function() {
|
||||
var res = codecov.upload({
|
||||
options: {
|
||||
dump: true,
|
||||
file: 'test' + pathSeparator + 'example.coverage.txt',
|
||||
},
|
||||
})
|
||||
expect(res.files[0].split(pathSeparator).pop()).toBe('example.coverage.txt')
|
||||
expect(res.body).toContain('this file is intentionally left blank')
|
||||
})
|
||||
|
||||
it('can specify report in cli fail', function() {
|
||||
var res = codecov.upload({ options: { dump: true, file: 'notreal.txt' } })
|
||||
expect(res.debug).toContain('failed: notreal.txt')
|
||||
})
|
||||
|
||||
// it("can detect .bowerrc with directory", function(){
|
||||
// fs.writeFileSync('.bowerrc', '{"directory": "test"}');
|
||||
// var res = codecov.upload({options: {dump: true}});
|
||||
// expect(res.files).toBe([]);
|
||||
// });
|
||||
|
||||
it('can detect .bowerrc without directory', function() {
|
||||
fs.writeFileSync('.bowerrc', '{"key": "value"}')
|
||||
var res = codecov.upload({ options: { dump: true } })
|
||||
expect(res.files[0].split(pathSeparator).pop()).toBe('example.coverage.txt')
|
||||
expect(res.body).toContain('this file is intentionally left blank')
|
||||
})
|
||||
|
||||
it('can disable search', function() {
|
||||
var res = codecov.upload({ options: { dump: true, disable: 'search' } })
|
||||
expect(res.debug).toContain('disabled search')
|
||||
expect(res.files).toEqual([])
|
||||
})
|
||||
|
||||
it('can disable gcov', function() {
|
||||
var res = codecov.upload({ options: { dump: true, disable: 'gcov' } })
|
||||
console.log(res.debug)
|
||||
expect(res.debug).toContain('disabled gcov')
|
||||
})
|
||||
|
||||
it('can disable detection', function() {
|
||||
var res = codecov.upload({ options: { dump: true, disable: 'detect' } })
|
||||
expect(res.debug).toContain('disabled detect')
|
||||
})
|
||||
|
||||
it('can get build from cli args', function() {
|
||||
var res = codecov.upload({ options: { dump: true, build: 'value' } })
|
||||
expect(res.query.build).toBe('value')
|
||||
})
|
||||
|
||||
it('can get commit from cli args', function() {
|
||||
var res = codecov.upload({ options: { dump: true, commit: 'value' } })
|
||||
expect(res.query.commit).toBe('value')
|
||||
})
|
||||
|
||||
it('can get branch from cli args', function() {
|
||||
var res = codecov.upload({ options: { dump: true, branch: 'value' } })
|
||||
expect(res.query.branch).toBe('value')
|
||||
})
|
||||
|
||||
it('can get slug from cli args', function() {
|
||||
var res = codecov.upload({ options: { dump: true, slug: 'value' } })
|
||||
expect(res.query.slug).toBe('value')
|
||||
})
|
||||
|
||||
it('can get flags from cli args', function() {
|
||||
var res = codecov.upload({ options: { dump: true, flags: 'value' } })
|
||||
expect(res.query.flags).toBe('value')
|
||||
})
|
||||
|
||||
it('can include env in cli', function() {
|
||||
process.env.HELLO = 'world'
|
||||
var res = codecov.upload({ options: { dump: true, env: 'HELLO,VAR1' } })
|
||||
expect(res.body).toContain('HELLO=world\n')
|
||||
expect(res.body).toContain('VAR1=\n')
|
||||
delete process.env.HELLO
|
||||
})
|
||||
|
||||
it('can include env in env', function() {
|
||||
process.env.HELLO = 'world'
|
||||
process.env.CODECOV_ENV = 'HELLO,VAR1'
|
||||
var res = codecov.upload({ options: { dump: true, env: 'VAR2' } })
|
||||
expect(res.body).toContain('HELLO=world\n')
|
||||
expect(res.body).toContain('VAR1=\n')
|
||||
expect(res.body).toContain('VAR2=\n')
|
||||
delete process.env.HELLO
|
||||
delete process.env.CODECOV_ENV
|
||||
})
|
||||
|
||||
it('can have custom args for gcov', function() {
|
||||
var res = codecov.upload({
|
||||
options: {
|
||||
dump: true,
|
||||
'gcov-root': 'folder/path',
|
||||
'gcov-glob': 'ignore/this/folder',
|
||||
'gcov-exec': 'llvm-gcov',
|
||||
'gcov-args': '-o',
|
||||
},
|
||||
})
|
||||
if (!isWindows) {
|
||||
expect(res.debug).toContain(
|
||||
"find folder/path -type f -name '*.gcno' -not -path 'ignore/this/folder' -exec llvm-gcov -o {} +"
|
||||
)
|
||||
} else {
|
||||
expect(res.debug).toContain(
|
||||
'for /f "delims=" %g in (\'dir /a-d /b /s *.gcno ^| findstr /i /v ignore/this/folder\') do llvm-gcov -o %g'
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
it('can read piped reports', function(done) {
|
||||
var exec = require('child_process').exec
|
||||
var childProcess = exec(
|
||||
'cat test/example.coverage.txt | bin/codecov -l --dump --disable=gcov',
|
||||
function(err, stdout) {
|
||||
expect(stdout.toString()).toContain('path=piped')
|
||||
expect(stdout.toString()).toContain(
|
||||
'this file is intentionally left blank'
|
||||
)
|
||||
childProcess.kill()
|
||||
done()
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
it('should have the correct version number', function() {
|
||||
var version = require('../package.json').version
|
||||
expect(codecov.version).toBe('v' + version)
|
||||
})
|
||||
|
||||
it('Should use codecov.yml via env variable', function() {
|
||||
var CWD = process.cwd()
|
||||
expect(
|
||||
codecov.upload({ options: { dump: true, disable: 'detect' } }).query.yaml
|
||||
).toBe(CWD + '/codecov.yml')
|
||||
|
||||
mockFs({
|
||||
'foo.yml': '',
|
||||
})
|
||||
process.env.codecov_yml = 'foo.yml'
|
||||
expect(
|
||||
codecov.upload({ options: { dump: true, disable: 'detect' } }).query.yaml
|
||||
).toBe(CWD + '/foo.yml')
|
||||
mockFs.restore()
|
||||
delete process.env.codecov_yml
|
||||
|
||||
mockFs({
|
||||
'FOO.yml': '',
|
||||
})
|
||||
process.env.CODECOV_YML = 'FOO.yml'
|
||||
expect(
|
||||
codecov.upload({ options: { dump: true, disable: 'detect' } }).query.yaml
|
||||
).toBe(CWD + '/FOO.yml')
|
||||
mockFs.restore()
|
||||
delete process.env.CODECOV_YML
|
||||
})
|
||||
|
||||
it('can get config from cli args', function() {
|
||||
mockFs({
|
||||
'foo.yml': '',
|
||||
})
|
||||
var res = codecov.upload({
|
||||
options: { dump: true, yml: 'foo.yml', disable: 'detect' },
|
||||
})
|
||||
expect(res.query.yaml).toBe(process.cwd() + '/foo.yml')
|
||||
mockFs.restore()
|
||||
})
|
||||
})
|
29
node_modules/codecov/test/services/appveyor.test.js
generated
vendored
Normal file
29
node_modules/codecov/test/services/appveyor.test.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
var appveyor = require('../../lib/services/appveyor')
|
||||
|
||||
describe('AppVeyor CI Provider', function() {
|
||||
it('can detect appveyor', function() {
|
||||
process.env.APPVEYOR = 'true'
|
||||
expect(appveyor.detect()).toBe(true)
|
||||
})
|
||||
|
||||
it('can get appveyor env info', function() {
|
||||
process.env.APPVEYOR_ACCOUNT_NAME = 'a'
|
||||
process.env.APPVEYOR_PROJECT_SLUG = 'b'
|
||||
process.env.APPVEYOR_REPO_COMMIT = '5678'
|
||||
process.env.APPVEYOR_REPO_BRANCH = 'master'
|
||||
process.env.APPVEYOR_PULL_REQUEST_NUMBER = '1'
|
||||
process.env.APPVEYOR_BUILD_VERSION = 'job'
|
||||
process.env.APPVEYOR_JOB_ID = 'build'
|
||||
process.env.APPVEYOR_REPO_NAME = 'owner/repo'
|
||||
|
||||
expect(appveyor.configuration()).toEqual({
|
||||
service: 'appveyor',
|
||||
commit: '5678',
|
||||
build: 'build',
|
||||
job: 'a/b/job',
|
||||
pr: '1',
|
||||
branch: 'master',
|
||||
slug: 'owner/repo',
|
||||
})
|
||||
})
|
||||
})
|
31
node_modules/codecov/test/services/azure-pipelines.test.js
generated
vendored
Normal file
31
node_modules/codecov/test/services/azure-pipelines.test.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
var azurePipelines = require('../../lib/services/azurePipelines')
|
||||
|
||||
describe('Azure Pipelines CI Provider', function() {
|
||||
it('can detect azure pipelines', function() {
|
||||
process.env.TF_BUILD = '1'
|
||||
expect(azurePipelines.detect()).toBe(true)
|
||||
})
|
||||
|
||||
it('can get azure pipelines env info', function() {
|
||||
process.env.BUILD_SOURCEBRANCH = 'master'
|
||||
process.env.SYSTEM_JOBID = '92a2fa25-f940-5df6-a185-81eb9ae2031d'
|
||||
process.env.BUILD_BUILDID = '1'
|
||||
process.env.SYSTEM_TEAMFOUNDATIONSERVERURI =
|
||||
'https://dev.azure.com/codecov/'
|
||||
process.env.SYSTEM_TEAMPROJECT = 'repo'
|
||||
process.env.BUILD_SOURCEVERSION = '743b04806ea677403aa2ff26c6bdeb85005de658'
|
||||
process.env.BUILD_REPOSITORY_ID = 'owner/repo'
|
||||
process.env.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER = '1234'
|
||||
|
||||
expect(azurePipelines.configuration()).toEqual({
|
||||
service: 'azure_pipelines',
|
||||
build: '1',
|
||||
build_url: 'https://dev.azure.com/codecov/repo/_build/results?buildId=1',
|
||||
job: '92a2fa25-f940-5df6-a185-81eb9ae2031d',
|
||||
commit: '743b04806ea677403aa2ff26c6bdeb85005de658',
|
||||
pr: '1234',
|
||||
branch: 'master',
|
||||
slug: 'owner/repo',
|
||||
})
|
||||
})
|
||||
})
|
25
node_modules/codecov/test/services/buildkite.test.js
generated
vendored
Normal file
25
node_modules/codecov/test/services/buildkite.test.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
var buildkite = require('../../lib/services/buildkite')
|
||||
|
||||
describe('Buildkite CI Provider', function() {
|
||||
it('can detect buildkite', function() {
|
||||
process.env.BUILDKITE = 'true'
|
||||
expect(buildkite.detect()).toBe(true)
|
||||
})
|
||||
|
||||
it('can get buildkite env info', function() {
|
||||
process.env.BUILDKITE_BUILD_NUMBER = '1'
|
||||
process.env.BUILDKITE_BUILD_URL = 'url'
|
||||
process.env.BUILDKITE_COMMIT = 'commit'
|
||||
process.env.BUILDKITE_BRANCH = 'branch'
|
||||
process.env.BUILDKITE_PROJECT_SLUG = 'slug'
|
||||
|
||||
expect(buildkite.configuration()).toEqual({
|
||||
service: 'buildkite',
|
||||
build: '1',
|
||||
build_url: 'url',
|
||||
commit: 'commit',
|
||||
branch: 'branch',
|
||||
slug: 'slug',
|
||||
})
|
||||
})
|
||||
})
|
63
node_modules/codecov/test/services/circle.test.js
generated
vendored
Normal file
63
node_modules/codecov/test/services/circle.test.js
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
var circle = require('../../lib/services/circle')
|
||||
|
||||
describe('Circle CI Provider', function() {
|
||||
it('can detect circle', function() {
|
||||
process.env.CIRCLECI = 'true'
|
||||
expect(circle.detect()).toBe(true)
|
||||
})
|
||||
|
||||
it('can get circle env info (CircleCI 1.0)', function() {
|
||||
process.env.CIRCLECI = 'true'
|
||||
process.env.CIRCLE_BUILD_NUM = '1234'
|
||||
process.env.CIRCLE_SHA1 = '5678'
|
||||
process.env.CIRCLE_BRANCH = 'master'
|
||||
process.env.CIRCLE_NODE_INDEX = '1'
|
||||
process.env.CIRCLE_PR_NUMBER = 'blah'
|
||||
process.env.CIRCLE_PROJECT_USERNAME = 'owner'
|
||||
process.env.CIRCLE_PROJECT_REPONAME = 'repo'
|
||||
expect(circle.configuration()).toEqual({
|
||||
service: 'circleci',
|
||||
commit: '5678',
|
||||
build: '1234.1',
|
||||
job: '1234.1',
|
||||
branch: 'master',
|
||||
pr: 'blah',
|
||||
slug: 'owner/repo',
|
||||
})
|
||||
})
|
||||
|
||||
it('can get circle env info (CircleCI 2.0)', function() {
|
||||
process.env.CIRCLECI = 'true'
|
||||
process.env.CIRCLE_BRANCH = 'master'
|
||||
process.env.CIRCLE_BUILD_NUM = '1234'
|
||||
process.env.CIRCLE_SHA1 = 'abcd'
|
||||
process.env.CIRCLE_NODE_INDEX = '1'
|
||||
process.env.CIRCLE_BUILD_URL = 'https://circleci.com/gh/owner/repo/1234'
|
||||
process.env.CIRCLE_COMPARE_URL =
|
||||
'https://github.com/owner/repo/2408ca9...3c36cfa'
|
||||
process.env.CIRCLE_NODE_INDEX = '1'
|
||||
process.env.CIRCLE_REPOSITORY_URL = 'git@github.com:owner/repo.git'
|
||||
delete process.env.CIRCLE_PR_NUMBER
|
||||
delete process.env.CIRCLE_PROJECT_USERNAME
|
||||
delete process.env.CIRCLE_PROJECT_REPONAME
|
||||
expect(circle.configuration()).toEqual({
|
||||
service: 'circleci',
|
||||
commit: 'abcd',
|
||||
build: '1234.1',
|
||||
job: '1234.1',
|
||||
branch: 'master',
|
||||
pr: undefined,
|
||||
slug: 'owner/repo',
|
||||
})
|
||||
})
|
||||
|
||||
it('throws if repo slug cannot be detected', function() {
|
||||
delete process.env.CIRCLE_PR_NUMBER
|
||||
delete process.env.CIRCLE_PROJECT_USERNAME
|
||||
delete process.env.CIRCLE_PROJECT_REPONAME
|
||||
delete process.env.CIRCLE_REPOSITORY_URL
|
||||
expect(function() {
|
||||
circle.configuration()
|
||||
}).toThrow()
|
||||
})
|
||||
})
|
27
node_modules/codecov/test/services/cirrus.test.js
generated
vendored
Normal file
27
node_modules/codecov/test/services/cirrus.test.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
var cirrus = require('../../lib/services/cirrus')
|
||||
|
||||
describe('Cirrus CI Provider', function() {
|
||||
it('can detect cirrus', function() {
|
||||
process.env.CIRRUS_CI = 'true'
|
||||
expect(cirrus.detect()).toBe(true)
|
||||
})
|
||||
|
||||
it('can get cirrus env info', function() {
|
||||
process.env.CIRRUS_CI = 'true'
|
||||
process.env.CIRRUS_BUILD_ID = '1234.1'
|
||||
process.env.CIRRUS_CHANGE_IN_REPO = '5678'
|
||||
process.env.CIRRUS_BRANCH = 'master'
|
||||
process.env.CIRRUS_TASK_ID = '1234.1'
|
||||
process.env.CIRRUS_PR = 'blah'
|
||||
process.env.CIRRUS_REPO_FULL_NAME = 'owner/repo'
|
||||
expect(cirrus.configuration()).toEqual({
|
||||
service: 'cirrusci',
|
||||
commit: '5678',
|
||||
build: '1234.1',
|
||||
job: '1234.1',
|
||||
branch: 'master',
|
||||
pr: 'blah',
|
||||
slug: 'owner/repo',
|
||||
})
|
||||
})
|
||||
})
|
53
node_modules/codecov/test/services/codebuild.test.js
generated
vendored
Normal file
53
node_modules/codecov/test/services/codebuild.test.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
var codebuild = require('../../lib/services/codebuild')
|
||||
|
||||
describe('AWS CodeBuild Provider', function() {
|
||||
it('can detect codebuild', function() {
|
||||
process.env.CODEBUILD_CI = 'true'
|
||||
expect(codebuild.detect()).toBe(true)
|
||||
})
|
||||
|
||||
it('can get codebuild env info', function() {
|
||||
process.env.CODEBUILD_CI = 'true'
|
||||
process.env.CODEBUILD_BUILD_ID =
|
||||
'my-project:e016b9d9-f2c8-4749-8373-7ca673b6d969'
|
||||
process.env.CODEBUILD_RESOLVED_SOURCE_VERSION =
|
||||
'39ec2418eca4c539d765574a1c68f3bd77e8c549'
|
||||
process.env.CODEBUILD_WEBHOOK_HEAD_REF = 'refs/heads/master'
|
||||
process.env.CODEBUILD_SOURCE_VERSION = 'pr/1'
|
||||
process.env.CODEBUILD_SOURCE_REPO_URL =
|
||||
'https://github.com/my-org/my-project.git'
|
||||
expect(codebuild.configuration()).toEqual({
|
||||
service: 'codebuild',
|
||||
build: 'my-project:e016b9d9-f2c8-4749-8373-7ca673b6d969',
|
||||
job: 'my-project:e016b9d9-f2c8-4749-8373-7ca673b6d969',
|
||||
commit: '39ec2418eca4c539d765574a1c68f3bd77e8c549',
|
||||
branch: 'master',
|
||||
pr: '1',
|
||||
slug: 'my-org/my-project',
|
||||
})
|
||||
})
|
||||
|
||||
it('throws if branch name cannot be detected', function() {
|
||||
delete process.env.CODEBUILD_WEBHOOK_HEAD_REF
|
||||
expect(function() {
|
||||
codebuild.configuration()
|
||||
}).toThrow()
|
||||
})
|
||||
|
||||
it('throws if pr number cannot be detected', function() {
|
||||
process.env.CODEBUILD_WEBHOOK_HEAD_REF = 'refs/heads/master'
|
||||
delete process.env.CODEBUILD_SOURCE_VERSION
|
||||
expect(function() {
|
||||
codebuild.configuration()
|
||||
}).toThrow()
|
||||
})
|
||||
|
||||
it('throws if slug cannot be detected', function() {
|
||||
process.env.CODEBUILD_RESOLVED_SOURCE_VERSION =
|
||||
'39ec2418eca4c539d765574a1c68f3bd77e8c549'
|
||||
delete process.env.CODEBUILD_SOURCE_REPO_URL
|
||||
expect(function() {
|
||||
codebuild.configuration()
|
||||
}).toThrow()
|
||||
})
|
||||
})
|
23
node_modules/codecov/test/services/codeship.test.js
generated
vendored
Normal file
23
node_modules/codecov/test/services/codeship.test.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
var codeship = require('../../lib/services/codeship')
|
||||
|
||||
describe('Codeship CI Provider', function() {
|
||||
it('can detect codeship', function() {
|
||||
process.env.CI_NAME = 'codeship'
|
||||
expect(codeship.detect()).toBe(true)
|
||||
})
|
||||
|
||||
it('can get codeship env info', function() {
|
||||
process.env.CI_BUILD_NUMBER = '1234'
|
||||
process.env.CI_COMMIT_ID = '5678'
|
||||
process.env.CI_BRANCH = 'master'
|
||||
process.env.CI_BUILD_URL = 'https://...'
|
||||
|
||||
expect(codeship.configuration()).toEqual({
|
||||
service: 'codeship',
|
||||
commit: '5678',
|
||||
build: '1234',
|
||||
branch: 'master',
|
||||
build_url: 'https://...',
|
||||
})
|
||||
})
|
||||
})
|
24
node_modules/codecov/test/services/drone.test.js
generated
vendored
Normal file
24
node_modules/codecov/test/services/drone.test.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
var drone = require('../../lib/services/drone')
|
||||
var git = require('../../lib/git')
|
||||
|
||||
describe('Drone.io CI Provider', function() {
|
||||
it('can detect drone', function() {
|
||||
process.env.DRONE = 'true'
|
||||
expect(drone.detect()).toBe(true)
|
||||
})
|
||||
|
||||
it('can get drone env info', function() {
|
||||
process.env.DRONE_BUILD_NUMBER = '1234'
|
||||
process.env.DRONE_BRANCH = 'master'
|
||||
process.env.DRONE_BUILD_URL = 'https://...'
|
||||
process.env.DRONE_BUILD_DIR = '/'
|
||||
expect(drone.configuration()).toEqual({
|
||||
service: 'drone.io',
|
||||
commit: git.head(),
|
||||
build: '1234',
|
||||
root: '/',
|
||||
branch: 'master',
|
||||
build_url: 'https://...',
|
||||
})
|
||||
})
|
||||
})
|
48
node_modules/codecov/test/services/gitlab.test.js
generated
vendored
Normal file
48
node_modules/codecov/test/services/gitlab.test.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
var gitlab = require('../../lib/services/gitlab')
|
||||
|
||||
describe('Gitlab CI Provider', function() {
|
||||
it('can detect gitlab', function() {
|
||||
process.env.GITLAB_CI = 'true'
|
||||
expect(gitlab.detect()).toBe(true)
|
||||
})
|
||||
|
||||
it('cannot detect gitlab', function() {
|
||||
delete process.env.GITLAB_CI
|
||||
expect(gitlab.detect()).toBe(false)
|
||||
})
|
||||
|
||||
it('can get service env info', function() {
|
||||
process.env.CI_BUILD_ID = '1234'
|
||||
process.env.CI_BUILD_REPO = 'https://gitlab.com/owner/repo.git'
|
||||
process.env.CI_BUILD_REF = '5678'
|
||||
process.env.CI_BUILD_REF_NAME = 'master'
|
||||
process.env.CI_PROJECT_DIR = '/'
|
||||
expect(gitlab.configuration()).toEqual({
|
||||
service: 'gitlab',
|
||||
build: '1234',
|
||||
root: '/',
|
||||
commit: '5678',
|
||||
slug: 'owner/repo',
|
||||
branch: 'master',
|
||||
})
|
||||
delete process.env.CI_BUILD_REPO
|
||||
process.env.CI_REPOSITORY_URL = 'https://gitlab.com/owner/repo2.git'
|
||||
expect(gitlab.configuration()).toEqual({
|
||||
service: 'gitlab',
|
||||
build: '1234',
|
||||
root: '/',
|
||||
commit: '5678',
|
||||
slug: 'owner/repo2',
|
||||
branch: 'master',
|
||||
})
|
||||
delete process.env.CI_REPOSITORY_URL
|
||||
expect(gitlab.configuration()).toEqual({
|
||||
service: 'gitlab',
|
||||
build: '1234',
|
||||
root: '/',
|
||||
commit: '5678',
|
||||
slug: '',
|
||||
branch: 'master',
|
||||
})
|
||||
})
|
||||
})
|
21
node_modules/codecov/test/services/heroku.test.js
generated
vendored
Normal file
21
node_modules/codecov/test/services/heroku.test.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
var heroku = require('../../lib/services/heroku')
|
||||
|
||||
describe('Heroku CI Provider', function() {
|
||||
it('can detect heroku', function() {
|
||||
process.env.HEROKU_TEST_RUN_ID = '454f5dc9-afa4-433f-bb28-84678a00fd98'
|
||||
expect(heroku.detect()).toBe(true)
|
||||
})
|
||||
|
||||
it('can get wercker env info', function() {
|
||||
process.env.HEROKU_TEST_RUN_ID = '454f5dc9-afa4-433f-bb28-84678a00fd98'
|
||||
process.env.HEROKU_TEST_RUN_COMMIT_VERSION =
|
||||
'743b04806ea677403aa2ff26c6bdeb85005de658'
|
||||
process.env.HEROKU_TEST_RUN_BRANCH = 'master'
|
||||
expect(heroku.configuration()).toEqual({
|
||||
service: 'heroku',
|
||||
commit: '743b04806ea677403aa2ff26c6bdeb85005de658',
|
||||
build: '454f5dc9-afa4-433f-bb28-84678a00fd98',
|
||||
branch: 'master',
|
||||
})
|
||||
})
|
||||
})
|
64
node_modules/codecov/test/services/jenkins.test.js
generated
vendored
Normal file
64
node_modules/codecov/test/services/jenkins.test.js
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
var jenkins = require('../../lib/services/jenkins')
|
||||
var git = require('../../lib/git')
|
||||
|
||||
describe('Jenkins CI Provider', function() {
|
||||
it('can detect jenkins', function() {
|
||||
process.env.JENKINS_URL = 'http://jenkins.jenkins.example/'
|
||||
expect(jenkins.detect()).toBe(true)
|
||||
})
|
||||
|
||||
it('can get service env info', function() {
|
||||
process.env.BUILD_NUMBER = '1234'
|
||||
process.env.BUILD_URL = 'http://asdf/'
|
||||
process.env.GIT_COMMIT = '5678'
|
||||
process.env.GIT_BRANCH = 'master'
|
||||
process.env.WORKSPACE = '/'
|
||||
expect(jenkins.configuration()).toEqual({
|
||||
service: 'jenkins',
|
||||
build_url: 'http://asdf/',
|
||||
build: '1234',
|
||||
root: '/',
|
||||
commit: '5678',
|
||||
pr: undefined,
|
||||
branch: 'master',
|
||||
})
|
||||
})
|
||||
|
||||
it('can get service env info when using Blue Ocean', function() {
|
||||
delete process.env.GIT_COMMIT
|
||||
delete process.env.GIT_BRANCH
|
||||
process.env.BUILD_NUMBER = '1234'
|
||||
process.env.BUILD_URL = 'http://asdf/'
|
||||
process.env.BRANCH_NAME = 'master'
|
||||
process.env.WORKSPACE = '/'
|
||||
expect(jenkins.configuration()).toEqual({
|
||||
service: 'jenkins',
|
||||
build_url: 'http://asdf/',
|
||||
build: '1234',
|
||||
root: '/',
|
||||
commit: git.head(),
|
||||
pr: undefined,
|
||||
branch: 'master',
|
||||
})
|
||||
})
|
||||
|
||||
it('github pull request env variables win out over jenkins variables', function() {
|
||||
process.env.BUILD_NUMBER = '1234'
|
||||
process.env.BUILD_URL = 'http://asdf/'
|
||||
process.env.GIT_COMMIT = '5678'
|
||||
process.env.ghprbActualCommit = '8765'
|
||||
process.env.GIT_BRANCH = 'master'
|
||||
process.env.ghprbSourceBranch = 'retsam'
|
||||
process.env.ghprbPullId = '1111'
|
||||
process.env.WORKSPACE = '/'
|
||||
expect(jenkins.configuration()).toEqual({
|
||||
service: 'jenkins',
|
||||
build_url: 'http://asdf/',
|
||||
build: '1234',
|
||||
root: '/',
|
||||
commit: '8765',
|
||||
pr: '1111',
|
||||
branch: 'retsam',
|
||||
})
|
||||
})
|
||||
})
|
17
node_modules/codecov/test/services/localGit.test.js
generated
vendored
Normal file
17
node_modules/codecov/test/services/localGit.test.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
var local = require('../../lib/services/localGit')
|
||||
var execSync = require('child_process').execSync
|
||||
|
||||
describe('Local git/mercurial CI Provider', function() {
|
||||
it('can get commit', function() {
|
||||
expect(local.configuration().commit).toMatch(/^\w{40}$/)
|
||||
expect(local.configuration().commit).toEqual(
|
||||
execSync("git rev-parse HEAD || hg id -i --debug | tr -d '+'")
|
||||
.toString()
|
||||
.trim()
|
||||
)
|
||||
})
|
||||
|
||||
it('can get branch', function() {
|
||||
expect(local.configuration().branch).not.toEqual(null)
|
||||
})
|
||||
})
|
40
node_modules/codecov/test/services/semaphore.test.js
generated
vendored
Normal file
40
node_modules/codecov/test/services/semaphore.test.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
var semaphore = require('../../lib/services/semaphore')
|
||||
|
||||
describe('Semaphore CI Provider', function() {
|
||||
var OLD_ENV = process.env
|
||||
|
||||
beforeEach(function() {
|
||||
process.env = Object.assign({}, OLD_ENV)
|
||||
})
|
||||
|
||||
afterEach(function() {
|
||||
process.env = Object.assign({}, OLD_ENV)
|
||||
})
|
||||
|
||||
it('can detect semaphore', function() {
|
||||
process.env.SEMAPHORE = 'true'
|
||||
process.env.SEMAPHORE_REPO_SLUG = 'owner/repo'
|
||||
expect(semaphore.detect()).toBe(true)
|
||||
})
|
||||
|
||||
it('does not detect semaphore 2.x', function() {
|
||||
process.env.SEMAPHORE = 'true'
|
||||
process.env.SEMAPHORE_WORKFLOW_ID = '65c9bb1c-aeb6-41f0-b8d9-6fa177241cdf'
|
||||
expect(semaphore.detect()).toBe(false)
|
||||
})
|
||||
|
||||
it('can get semaphore env info', function() {
|
||||
process.env.SEMAPHORE_BUILD_NUMBER = '1234'
|
||||
process.env.REVISION = '5678'
|
||||
process.env.SEMAPHORE_CURRENT_THREAD = '1'
|
||||
process.env.BRANCH_NAME = 'master'
|
||||
process.env.SEMAPHORE_REPO_SLUG = 'owner/repo'
|
||||
expect(semaphore.configuration()).toEqual({
|
||||
service: 'semaphore1x',
|
||||
commit: '5678',
|
||||
build: '1234.1',
|
||||
branch: 'master',
|
||||
slug: 'owner/repo',
|
||||
})
|
||||
})
|
||||
})
|
37
node_modules/codecov/test/services/semaphore2x.test.js
generated
vendored
Normal file
37
node_modules/codecov/test/services/semaphore2x.test.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
var semaphore2 = require('../../lib/services/semaphore2x')
|
||||
|
||||
describe('Semaphore 2.x CI Provider', function() {
|
||||
var OLD_ENV = process.env
|
||||
|
||||
beforeEach(function() {
|
||||
process.env = Object.assign({}, OLD_ENV)
|
||||
})
|
||||
|
||||
afterEach(function() {
|
||||
process.env = Object.assign({}, OLD_ENV)
|
||||
})
|
||||
|
||||
it('can detect semaphore 2x', function() {
|
||||
process.env.SEMAPHORE = 'true'
|
||||
process.env.SEMAPHORE_WORKFLOW_ID = '65c9bb1c-aeb6-41f0-b8d9-6fa177241cdf'
|
||||
expect(semaphore2.detect()).toBe(true)
|
||||
})
|
||||
|
||||
it('does not detect semaphore 1.x', function() {
|
||||
process.env.SEMAPHORE = 'true'
|
||||
process.env.SEMAPHORE_REPO_SLUG = 'owner/repo'
|
||||
expect(semaphore2.detect()).toBe(false)
|
||||
})
|
||||
|
||||
it('can get semaphore env info', function() {
|
||||
process.env.SEMAPHORE_GIT_BRANCH = 'development'
|
||||
process.env.SEMAPHORE_GIT_SHA = '5c84719708b9b649b9ef3b56af214f38cee6acde'
|
||||
process.env.SEMAPHORE_WORKFLOW_ID = '65c9bb1c-aeb6-41f0-b8d9-6fa177241cdf'
|
||||
expect(semaphore2.configuration()).toEqual({
|
||||
service: 'semaphore2x',
|
||||
branch: 'development',
|
||||
build: '65c9bb1c-aeb6-41f0-b8d9-6fa177241cdf',
|
||||
commit: '5c84719708b9b649b9ef3b56af214f38cee6acde',
|
||||
})
|
||||
})
|
||||
})
|
27
node_modules/codecov/test/services/shippable.test.js
generated
vendored
Normal file
27
node_modules/codecov/test/services/shippable.test.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
var shippable = require('../../lib/services/shippable')
|
||||
|
||||
describe('Shippable CI Provider', function() {
|
||||
it('can detect shippable', function() {
|
||||
process.env.SHIPPABLE = 'true'
|
||||
expect(shippable.detect()).toBe(true)
|
||||
})
|
||||
it('can get shippable env info get_commit_status', function() {
|
||||
process.env.SHIPPABLE = 'true'
|
||||
process.env.BUILD_URL = 'http://...'
|
||||
process.env.COMMIT = '5678'
|
||||
process.env.BUILD_NUMBER = '91011'
|
||||
process.env.BUILD_URL = 'http://...'
|
||||
process.env.BRANCH = 'master'
|
||||
process.env.PULL_REQUEST = '2'
|
||||
process.env.REPO_NAME = 'owner/repo'
|
||||
expect(shippable.configuration()).toEqual({
|
||||
service: 'shippable',
|
||||
commit: '5678',
|
||||
build: '91011',
|
||||
build_url: 'http://...',
|
||||
branch: 'master',
|
||||
pr: '2',
|
||||
slug: 'owner/repo',
|
||||
})
|
||||
})
|
||||
})
|
40
node_modules/codecov/test/services/snap.test.js
generated
vendored
Normal file
40
node_modules/codecov/test/services/snap.test.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
var snap = require('../../lib/services/snap')
|
||||
|
||||
describe('Snap CI Provider', function() {
|
||||
it('can detect snap', function() {
|
||||
process.env.SNAP_CI = 'true'
|
||||
expect(snap.detect()).toBe(true)
|
||||
})
|
||||
|
||||
it('can get snap env info get_commit_status', function() {
|
||||
process.env.SNAP_CI = 'true'
|
||||
process.env.SNAP_PIPELINE_COUNTER = '1234'
|
||||
process.env.SNAP_COMMIT = '5678'
|
||||
process.env.SNAP_BRANCH = 'master'
|
||||
process.env.SNAP_PULL_REQUEST_NUMBER = 'blah'
|
||||
expect(snap.configuration()).toEqual({
|
||||
service: 'snap',
|
||||
commit: '5678',
|
||||
build: '1234',
|
||||
branch: 'master',
|
||||
pr: 'blah',
|
||||
})
|
||||
})
|
||||
|
||||
it('can get snap env info get_commit_status for pull requests', function() {
|
||||
process.env.SNAP_COMMIT = ''
|
||||
process.env.SNAP_BRANCH = ''
|
||||
process.env.SNAP_CI = 'true'
|
||||
process.env.SNAP_PIPELINE_COUNTER = '1234'
|
||||
process.env.SNAP_UPSTREAM_COMMIT = '5678'
|
||||
process.env.SNAP_UPSTREAM_BRANCH = 'upstream-branch'
|
||||
process.env.SNAP_PULL_REQUEST_NUMBER = 'blah'
|
||||
expect(snap.configuration()).toEqual({
|
||||
service: 'snap',
|
||||
commit: '5678',
|
||||
build: '1234',
|
||||
branch: 'upstream-branch',
|
||||
pr: 'blah',
|
||||
})
|
||||
})
|
||||
})
|
22
node_modules/codecov/test/services/teamcity.test.js
generated
vendored
Normal file
22
node_modules/codecov/test/services/teamcity.test.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
var teamcity = require('../../lib/services/teamcity')
|
||||
|
||||
describe('TeamCity CI Provider', function() {
|
||||
it('can detect teamcity', function() {
|
||||
process.env.TEAMCITY_VERSION = '8910'
|
||||
expect(teamcity.detect()).toBe(true)
|
||||
})
|
||||
|
||||
it('can get teamcity env info get_commit_status', function() {
|
||||
process.env.TEAMCITY_VERSION = '8910'
|
||||
process.env.BUILD_VCS_NUMBER = '4567'
|
||||
process.env.BRANCH_NAME = 'ABranch'
|
||||
process.env.BUILD_NUMBER = '1234'
|
||||
|
||||
expect(teamcity.configuration()).toEqual({
|
||||
service: 'teamcity',
|
||||
commit: '4567',
|
||||
branch: 'ABranch',
|
||||
build: '1234',
|
||||
})
|
||||
})
|
||||
})
|
28
node_modules/codecov/test/services/travis.test.js
generated
vendored
Normal file
28
node_modules/codecov/test/services/travis.test.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
var travis = require('../../lib/services/travis')
|
||||
|
||||
describe('Travis CI Provider', function() {
|
||||
it('can detect travis', function() {
|
||||
process.env.TRAVIS = 'true'
|
||||
expect(travis.detect()).toBe(true)
|
||||
})
|
||||
it('can get travis env info get_commit_status', function() {
|
||||
process.env.TRAVIS = 'true'
|
||||
process.env.TRAVIS_JOB_ID = '1234'
|
||||
process.env.TRAVIS_COMMIT = '5678'
|
||||
process.env.TRAVIS_JOB_NUMBER = '91011'
|
||||
process.env.TRAVIS_BRANCH = 'master'
|
||||
process.env.TRAVIS_PULL_REQUEST = 'blah'
|
||||
process.env.TRAVIS_BUILD_DIR = '/'
|
||||
process.env.TRAVIS_REPO_SLUG = 'owner/repo'
|
||||
expect(travis.configuration()).toEqual({
|
||||
service: 'travis',
|
||||
commit: '5678',
|
||||
build: '91011',
|
||||
branch: 'master',
|
||||
root: '/',
|
||||
job: '1234',
|
||||
pr: 'blah',
|
||||
slug: 'owner/repo',
|
||||
})
|
||||
})
|
||||
})
|
25
node_modules/codecov/test/services/wercker.test.js
generated
vendored
Normal file
25
node_modules/codecov/test/services/wercker.test.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
var wercker = require('../../lib/services/wercker')
|
||||
|
||||
describe('Wercker CI Provider', function() {
|
||||
it('can detect wercker', function() {
|
||||
process.env.WERCKER_MAIN_PIPELINE_STARTED = '1399372237'
|
||||
expect(wercker.detect()).toBe(true)
|
||||
})
|
||||
|
||||
it('can get wercker env info', function() {
|
||||
process.env.WERCKER_MAIN_PIPELINE_STARTED = '1399372237'
|
||||
process.env.WERCKER_GIT_COMMIT = '5678'
|
||||
process.env.WERCKER_GIT_BRANCH = 'master'
|
||||
process.env.WERCKER_BUILD_URL = 'https://...'
|
||||
process.env.WERCKER_GIT_OWNER = 'owner'
|
||||
process.env.WERCKER_GIT_REPOSITORY = 'repo'
|
||||
expect(wercker.configuration()).toEqual({
|
||||
service: 'wercker',
|
||||
commit: '5678',
|
||||
build: '1399372237',
|
||||
branch: 'master',
|
||||
build_url: 'https://...',
|
||||
slug: 'owner/repo',
|
||||
})
|
||||
})
|
||||
})
|
97
node_modules/codecov/test/upload.test.js
generated
vendored
Normal file
97
node_modules/codecov/test/upload.test.js
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
var fs = require('fs')
|
||||
var codecov = require('../lib/codecov')
|
||||
var offlineErrors = require('../lib/offline')
|
||||
|
||||
describe('Codecov', function() {
|
||||
beforeEach(function() {
|
||||
try {
|
||||
fs.unlinkSync('report.tmp')
|
||||
} catch (e) {}
|
||||
})
|
||||
|
||||
afterAll(function() {
|
||||
try {
|
||||
fs.unlinkSync('report.tmp')
|
||||
} catch (e) {}
|
||||
})
|
||||
|
||||
it('can get upload to v2', function(done) {
|
||||
var self = this
|
||||
codecov.sendToCodecovV2(
|
||||
'https://codecov.io',
|
||||
{
|
||||
token: 'f881216b-b5c0-4eb1-8f21-b51887d1d506',
|
||||
commit: 'c739768fcac68144a3a6d82305b9c4106934d31a',
|
||||
branch: 'master',
|
||||
},
|
||||
'testing node-' + codecov.version,
|
||||
function(body) {
|
||||
expect(body).toContain(
|
||||
'https://codecov.io/github/codecov/ci-repo/commit/c739768fcac68144a3a6d82305b9c4106934d31a'
|
||||
)
|
||||
done()
|
||||
},
|
||||
function(errCode, errMsg) {
|
||||
if (offlineErrors.indexOf(errCode) !== -1) {
|
||||
self.skip() // offline - we can not test upload
|
||||
return
|
||||
}
|
||||
throw new Error(errMsg)
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
it('can get upload to v3', function(done) {
|
||||
var self = this
|
||||
jest.setTimeout(10000) // give this test extra time to run (default is 2000ms)
|
||||
codecov.sendToCodecovV3(
|
||||
'https://codecov.io',
|
||||
{
|
||||
token: 'f881216b-b5c0-4eb1-8f21-b51887d1d506',
|
||||
commit: 'c739768fcac68144a3a6d82305b9c4106934d31a',
|
||||
branch: 'master',
|
||||
},
|
||||
'testing node-' + codecov.version,
|
||||
function(body) {
|
||||
expect(body).toContain(
|
||||
'https://codecov.io/github/codecov/ci-repo/commit/c739768fcac68144a3a6d82305b9c4106934d31a'
|
||||
)
|
||||
done()
|
||||
},
|
||||
function(errCode, errMsg) {
|
||||
if (offlineErrors.indexOf(errCode) !== -1) {
|
||||
self.skip() // offline - we can not test upload
|
||||
return
|
||||
}
|
||||
throw new Error(errMsg)
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
it("upload v2 doesn't throw runtime error", function(done) {
|
||||
expect(
|
||||
codecov.sendToCodecovV2.bind(
|
||||
null,
|
||||
'https://codecov.io',
|
||||
{
|
||||
token: 'f881216b-b5c0-4eb1-8f21-b51887d1d506',
|
||||
commit: 'c739768fcac68144a3a6d82305b9c4106934d31a',
|
||||
branch: 'master',
|
||||
},
|
||||
'testing node-' + codecov.version,
|
||||
function(body) {
|
||||
expect(body).toContain(
|
||||
'https://codecov.io/github/codecov/ci-repo/commit/c739768fcac68144a3a6d82305b9c4106934d31a'
|
||||
)
|
||||
done()
|
||||
},
|
||||
function(errCode, errMsg) {
|
||||
if (offlineErrors.indexOf(errCode) !== -1) {
|
||||
done()
|
||||
}
|
||||
throw new Error(errMsg)
|
||||
}
|
||||
)
|
||||
).not.toThrow()
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user