Socket
Socket
Sign inDemoInstall

codecov

Package Overview
Dependencies
Maintainers
3
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codecov - npm Package Compare versions

Comparing version 3.0.3 to 3.0.4

.prettierignore

4

index.js

@@ -1,3 +0,3 @@

var handleInput = require('./lib/codecov');
var handleInput = require('./lib/codecov')
exports.handleInput = handleInput;
exports.handleInput = handleInput

@@ -1,265 +0,302 @@

var fs = require('fs');
var path = require('path');
var request = require('request');
var urlgrey = require('urlgrey');
var walk = require('ignore-walk');
var execSync = require('child_process').execSync;
var fs = require('fs')
var path = require('path')
var request = require('request')
var urlgrey = require('urlgrey')
var walk = require('ignore-walk')
var execSync = require('child_process').execSync
var detectProvider = require('./detect');
var detectProvider = require('./detect')
var version = 'v' + require('../package.json').version;
var version = 'v' + require('../package.json').version
var patterns, more_patterns = '';
var patterns,
more_patterns = ''
var isWindows = process.platform.match(/win32/) || process.platform.match(/win64/)
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'";
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 '
}
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){
var sendToCodecovV2 = function(
codecov_endpoint,
query,
upload_body,
on_success,
on_failure
) {
// Direct to Codecov
request.post(
{
url : urlgrey(codecov_endpoint + '/upload/v2').query(query).toString(),
body : upload_body,
headers : {
url: urlgrey(codecov_endpoint + '/upload/v2')
.query(query)
.toString(),
body: upload_body,
headers: {
'Content-Type': 'text/plain',
'Accept': 'text/plain'
}
}, function(err, response, result){
Accept: 'text/plain',
},
},
function(err, response, result) {
if (err || response.statusCode !== 200) {
console.log(' ' + (err || response.body));
return response ? on_failure(response.statusCode, response.body) : on_failure(err.code, err.message);
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);
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){
var sendToCodecovV3 = function(
codecov_endpoint,
query,
upload_body,
on_success,
on_failure
) {
// Direct to S3
request.post(
{
url : urlgrey(codecov_endpoint + '/upload/v4').query(query).toString(),
body : '',
headers : {
url: urlgrey(codecov_endpoint + '/upload/v4')
.query(query)
.toString(),
body: '',
headers: {
'Content-Type': 'text/plain',
'Accept': 'text/plain'
}
}, function(err, response, result){
Accept: 'text/plain',
},
},
function(err, response, result) {
if (err) {
sendToCodecovV2(codecov_endpoint, query, upload_body, on_success, on_failure);
sendToCodecovV2(
codecov_endpoint,
query,
upload_body,
on_success,
on_failure
)
} else {
var codecov_report_url = result.split('\n')[0];
var codecov_report_url = result.split('\n')[0]
request.put(
{
url : result.split('\n')[1],
body : upload_body,
headers : {
url: result.split('\n')[1],
body: upload_body,
headers: {
'Content-Type': 'text/plain',
'x-amz-acl': 'public-read'
}
}, function(err, response, result){
'x-amz-acl': 'public-read',
},
},
function(err, response, result) {
if (err) {
sendToCodecovV2(codecov_endpoint, query, upload_body, on_success, on_failure);
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);
console.log(' Success!')
console.log(' View report at: ' + codecov_report_url)
on_success(codecov_report_url)
}
}
);
)
}
}
);
)
}
};
var upload = function(args, on_success, on_failure){
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 codecov_endpoint =
args.options.url ||
process.env.codecov_url ||
process.env.CODECOV_URL ||
'https://codecov.io'
var query = {}
var debug = []
console.log(''+
' _____ _ \n' +
' / ____| | | \n' +
'| | ___ __| | ___ ___ _____ __ \n' +
'| | / _ \\ / _` |/ _ \\/ __/ _ \\ \\ / / \n' +
'| |___| (_) | (_| | __/ (_| (_) \\ V / \n' +
' \\_____\\___/ \\__,_|\\___|\\___\\___/ \\_/ \n' +
' ' + version);
console.log(
'' +
' _____ _ \n' +
' / ____| | | \n' +
'| | ___ __| | ___ ___ _____ __ \n' +
'| | / _ \\ / _` |/ _ \\/ __/ _ \\ \\ / / \n' +
'| |___| (_) | (_| | __/ (_| (_) \\ V / \n' +
' \\_____\\___/ \\__,_|\\___|\\___\\___/ \\_/ \n' +
' ' +
version
)
query.yaml = ['codecov.yml', '.codecov.yml'].reduce(function (result, file) {
return result || (fs.existsSync(path.resolve(process.cwd(), file)) ? file : undefined)
query.yaml = ['codecov.yml', '.codecov.yml'].reduce(function(result, file) {
return (
result ||
(fs.existsSync(path.resolve(process.cwd(), file)) ? file : undefined)
)
}, undefined)
if ((args.options.disable || '').split(',').indexOf('detect') === -1) {
console.log('==> Detecting CI Provider');
query = detectProvider();
console.log('==> Detecting CI Provider')
query = detectProvider()
} else {
debug.push('disabled detect');
debug.push('disabled detect')
}
if (args.options.build) {
query.build = args.options.build;
query.build = args.options.build
}
if (args.options.commit) {
query.commit = args.options.commit;
query.commit = args.options.commit
}
if (args.options.branch) {
query.branch = args.options.branch;
query.branch = args.options.branch
}
if (args.options.slug) {
query.slug = args.options.slug;
query.slug = args.options.slug
}
var flags = (args.options.flags || process.env.codecov_flags || process.env.CODECOV_FLAGS);
var flags =
args.options.flags || process.env.codecov_flags || process.env.CODECOV_FLAGS
if (flags) {
query.flags = flags;
query.flags = flags
}
var token = (args.options.token || process.env.codecov_token || process.env.CODECOV_TOKEN);
if (token){
query.token = token;
var token =
args.options.token || process.env.codecov_token || process.env.CODECOV_TOKEN
if (token) {
query.token = token
}
query.package = 'node-' + version;
query.package = 'node-' + version
console.log("==> Configuration: ");
console.log(" Endpoint: " + codecov_endpoint);
console.log('==> Configuration: ')
console.log(' Endpoint: ' + codecov_endpoint)
// Don't output `query` directly as it contains the upload token

@@ -269,19 +306,25 @@ console.log({

branch: query.branch,
package: query.package
});
package: query.package,
})
var upload = "";
var upload = ''
// Add specified env vars
var env_found = false;
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(',');
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;
upload += env[i] + '=' + (process.env[env[i]] || '').toString() + '\n'
env_found = true
}
}
if (env_found) {
upload += '<<<<<< ENV\n';
upload += '<<<<<< ENV\n'
}

@@ -291,9 +334,16 @@ }

// List git files
var root = path.resolve(args.options.root || query.root || '.');
console.log('==> Building file structure');
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';
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';
upload +=
walk
.sync({ path: root, ignoreFiles: ['.gitignore', '.hgignore'] })
.join('\n')
.trim() + '\n<<<<<< network\n'
}

@@ -303,43 +353,77 @@ // Make gcov reports

try {
console.log('==> Generating gcov reports (skip via --disable=gcov)');
var gcg = args.options['gcov-glob'] || '';
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(' ');
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(' ');
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'] || '')+" {} +";
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";
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);
debug.push(gcov)
console.log(' $ ' + gcov)
execSync(gcov)
} catch (e) {
console.log(' Failed to run gcov command.');
console.log(' Failed to run gcov command.')
}
} else {
debug.push('disabled gcov');
debug.push('disabled gcov')
}
// Detect .bowerrc
var bowerrc;
if(!isWindows) {
bowerrc = execSync('test -f .bowerrc && cat .bowerrc || echo ""', { cwd: root }).toString().trim();
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();
bowerrc = execSync('if exist .bowerrc type .bowerrc', { cwd: root })
.toString()
.trim()
}
if (bowerrc) {
bowerrc = JSON.parse(bowerrc).directory;
bowerrc = JSON.parse(bowerrc).directory
if (bowerrc) {
if(!isWindows) {
more_patterns = " -not -path '*/" + bowerrc.toString().replace(/\/$/, '') + "/*'";
if (!isWindows) {
more_patterns =
" -not -path '*/" + bowerrc.toString().replace(/\/$/, '') + "/*'"
} else {
more_patterns = '| findstr /i /v \\' + bowerrc.toString().replace(/\/$/, '') + '\\';
more_patterns =
'| findstr /i /v \\' + bowerrc.toString().replace(/\/$/, '') + '\\'
}

@@ -349,35 +433,52 @@ }

var files = [], file = null;
var files = [],
file = null
// Append manually entered reports
if (args.options.file) {
file = args.options.file;
console.log('==> Targeting specific file');
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);
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);
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');
console.log('==> Scanning for reports')
var _files
if(!isWindows) {
_files = execSync('find ' + root + ' ' + patterns + more_patterns).toString().trim().split('\n');
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');
_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];
file = _files[i2]
try {
upload += '# path=' + file + '\n' + fs.readFileSync(file, 'utf8').toString() + '\n<<<<<< EOF\n';
console.log(' + ' + file);
files.push(file);
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);
debug.push('failed: ' + file.split('/').pop())
console.log(' X Failed to read file at ' + file)
}

@@ -387,3 +488,3 @@ }

} else {
debug.push('disabled search');
debug.push('disabled search')
}

@@ -394,29 +495,32 @@

if (args.options.dump) {
console.log('-------- DEBUG START --------');
console.log(upload);
console.log('-------- DEBUG END --------');
console.log('-------- DEBUG START --------')
console.log(upload)
console.log('-------- DEBUG END --------')
} else {
console.log('==> Uploading reports');
var _upload;
console.log('==> Uploading reports')
var _upload
if ((args.options.disable || '').split(',').indexOf('s3') === -1) {
_upload = sendToCodecovV3;
_upload = sendToCodecovV3
} else {
_upload = sendToCodecovV2;
_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(){});
_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() {}
)
}

@@ -430,7 +534,6 @@ }

debug: debug,
url: codecov_endpoint
};
url: codecov_endpoint,
}
}
};
module.exports = {

@@ -440,3 +543,3 @@ upload: upload,

sendToCodecovV2: sendToCodecovV2,
sendToCodecovV3: sendToCodecovV3
};
sendToCodecovV3: sendToCodecovV3,
}
var services = {
'travis' : require('./services/travis'),
'circle' : require('./services/circle'),
'buildkite' : require('./services/buildkite'),
'codeship' : require('./services/codeship'),
'drone' : require('./services/drone'),
'appveyor' : require('./services/appveyor'),
'wercker' : require('./services/wercker'),
'jenkins' : require('./services/jenkins'),
'semaphore' : require('./services/semaphore'),
'snap' : require('./services/snap'),
'gitlab' : require('./services/gitlab')
};
travis: require('./services/travis'),
circle: require('./services/circle'),
buildkite: require('./services/buildkite'),
codeship: require('./services/codeship'),
drone: require('./services/drone'),
appveyor: require('./services/appveyor'),
wercker: require('./services/wercker'),
jenkins: require('./services/jenkins'),
semaphore: require('./services/semaphore'),
snap: require('./services/snap'),
gitlab: require('./services/gitlab'),
}
var detectProvider = function(){
var config;
for (var name in services){
if (services[name].detect()){
config = services[name].configuration();
break;
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.");
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;
};
return config
}
module.exports = detectProvider;
module.exports = detectProvider

@@ -1,13 +0,15 @@

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

@@ -11,5 +11,5 @@ // see: http://man7.org/linux/man-pages/man2/accept.2.html#ERRORS

'EOPNOTSUPP',
'ENETUNREACH'
'ENETUNREACH',
]
module.exports = offlineErrorCodes;
module.exports = offlineErrorCodes
module.exports = {
detect : function(){
return !!process.env.APPVEYOR;
detect: function() {
return !!process.env.APPVEYOR
},
configuration : function(){
console.log(' AppVeyor CI Detected');
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,
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
};
}
};
slug: process.env.APPVEYOR_REPO_NAME,
}
},
}
module.exports = {
detect : function(){
return !!process.env.BUILDKITE;
detect: function() {
return !!process.env.BUILDKITE
},
configuration : function(){
configuration: function() {
// https://buildkite.com/docs/guides/environment-variables
console.log(' Buildkite CI Detected');
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
};
}
};
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,
}
},
}
module.exports = {
detect : function(){
return !!process.env.CIRCLECI;
detect: function() {
return !!process.env.CIRCLECI
},
configuration : function(){
console.log(' Circle CI Detected');
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,
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(){
slug: detectRepoSlug(),
}
function detectRepoSlug() {
if (process.env.CIRCLE_PROJECT_REPONAME) {

@@ -24,3 +23,7 @@ // CircleCI 1.0

// CIRCLE_REPOSITORY_URL=https://github.com/codecov/codecov-node (note: GitHub Web URL)
return process.env.CIRCLE_PROJECT_USERNAME + '/' + process.env.CIRCLE_PROJECT_REPONAME;
return (
process.env.CIRCLE_PROJECT_USERNAME +
'/' +
process.env.CIRCLE_PROJECT_REPONAME
)
}

@@ -30,8 +33,10 @@ if (process.env.CIRCLE_REPOSITORY_URL) {

// CIRCLE_REPOSITORY_URL=git@github.com:codecov/codecov-node.git (note: Git/SSH URL)
return process.env.CIRCLE_REPOSITORY_URL.replace(/^.*:/, '').replace(/\.git$/, '');
return process.env.CIRCLE_REPOSITORY_URL.replace(/^.*:/, '').replace(
/\.git$/,
''
)
}
throw new Error('Cannot detect repository slug.');
throw new Error('Cannot detect repository slug.')
}
}
};
},
}
module.exports = {
detect : function(){
return (process.env.CI_NAME && process.env.CI_NAME === 'codeship');
detect: function() {
return process.env.CI_NAME && process.env.CI_NAME === 'codeship'
},
configuration : function(){
console.log(' Codeship CI Detected');
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
};
}
};
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,
}
},
}

@@ -1,21 +0,19 @@

var git = require('../git');
var git = require('../git')
module.exports = {
detect : function(){
return !!process.env.DRONE;
detect: function() {
return !!process.env.DRONE
},
configuration : function(){
console.log(' Drone.io CI Detected');
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
};
}
};
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,
}
},
}
// https://docs.gitlab.com/ce/ci/variables/README.html
module.exports = {
detect : function(){
return !!process.env.GITLAB_CI;
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 || '';
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', '')
};
}
};
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', ''),
}
},
}

@@ -1,22 +0,24 @@

var git = require('../git');
var git = require('../git')
module.exports = {
detect : function(){
return !!process.env.JENKINS_URL;
detect: function() {
return !!process.env.JENKINS_URL
},
configuration : function(){
console.log(' Jenkins CI Detected');
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
};
}
};
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,
}
},
}
var git = require('../git')
module.exports = {
configuration : function(){
console.log(' No CI Detected. Using git/mercurial');
var branch = git.branch();
configuration: function() {
console.log(' No CI Detected. Using git/mercurial')
var branch = git.branch()
if (branch === 'HEAD') {
branch = 'master';
branch = 'master'
}
var head = git.head();
var head = git.head()
return {
commit : head,
branch : branch
};
}
};
commit: head,
branch: branch,
}
},
}

@@ -1,19 +0,19 @@

module.exports = {
detect : function(){
return !!process.env.SEMAPHORE;
detect: function() {
return !!process.env.SEMAPHORE
},
configuration : function(){
console.log(' Semaphore CI Detected');
configuration: function() {
console.log(' Semaphore CI Detected')
return {
service : 'semaphore',
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
};
}
};
service: 'semaphore',
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,
}
},
}

@@ -1,22 +0,19 @@

module.exports = {
detect : function(){
return !!process.env.SHIPPABLE;
detect: function() {
return !!process.env.SHIPPABLE
},
configuration : function(){
configuration: function() {
// http://docs.shippable.com/en/latest/config.html#common-environment-variables
console.log(' Shippable CI Detected');
console.log(' Shippable CI Detected')
return {
service : 'shippable',
build : process.env.BUILD_NUMBER,
build_url : process.env.BUILD_URL,
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
};
}
};
commit: process.env.COMMIT,
branch: process.env.BRANCH,
slug: process.env.REPO_NAME,
}
},
}
module.exports = {
detect : function(){
return !!process.env.SNAP_CI;
detect: function() {
return !!process.env.SNAP_CI
},
configuration : function(){
console.log(' Snap CI Detected');
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,
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,
};
}
};
}
},
}
module.exports = {
detect : function(){
return !!process.env.TRAVIS;
detect: function() {
return !!process.env.TRAVIS
},
configuration : function(){
console.log(' Travis CI Detected');
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,
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
};
}
};
slug: process.env.TRAVIS_REPO_SLUG,
root: process.env.TRAVIS_BUILD_DIR,
}
},
}
// http://devcenter.wercker.com/articles/steps/variables.html
module.exports = {
detect : function(){
return !!process.env.WERCKER_MAIN_PIPELINE_STARTED;
detect: function() {
return !!process.env.WERCKER_MAIN_PIPELINE_STARTED
},
configuration : function(){
console.log(' Wercker CI Detected');
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
};
}
};
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,
}
},
}
{
"name": "codecov",
"version": "3.0.3",
"version": "3.0.4",
"description": "Uploading report to Codecov: https://codecov.io",
"main": "index.js",
"scripts": {
"test": "./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec"
"precommit": "lint-staged",
"test":
"./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec"
},

@@ -13,8 +15,3 @@ "repository": {

},
"keywords": [
"coverage",
"code-coverage",
"codecov.io",
"codecov"
],
"keywords": ["coverage", "code-coverage", "codecov.io", "codecov"],
"bin": {

@@ -24,3 +21,3 @@ "codecov": "./bin/codecov"

"engines": {
"node": ">=1.0"
"node": ">=4.0"
},

@@ -34,13 +31,19 @@ "author": "Codecov <hello@codecov.io>",

"dependencies": {
"argv": "0.0.2",
"ignore-walk": "3.0.0",
"request": "2.81.0",
"urlgrey": "0.4.4"
"argv": "^0.0.2",
"ignore-walk": "^3.0.1",
"request": "^2.87.0",
"urlgrey": "^0.4.4"
},
"devDependencies": {
"expect.js": "^0.3.1",
"husky": "^0.14.3",
"istanbul": "^0.4.5",
"jshint": "^2.9.3",
"mocha": "^3.0.2"
"lint-staged": "^7.2.0",
"mocha": "^5.2.0",
"prettier": "^1.13.7"
},
"lint-staged": {
"**/*.js": ["prettier --write --parser=babylon", "git add"],
"**/*.json": ["prettier --write --parser=json", "git add"]
}
}

@@ -97,1 +97,2 @@ # Codecov NodeJS Uploader

- v3.0.2 Security fixes
- v3.0.3 Support non-git/hg root dirs

@@ -1,19 +0,17 @@

var detect = require("../lib/detect");
var git = require("../lib/git");
var detect = require('../lib/detect')
var git = require('../lib/git')
describe("Codecov", function(){
describe('Codecov', function() {
it('can detect existing appveyor service', function() {
process.env.TRAVIS = 'true'
it("can detect existing appveyor service", function(){
process.env.TRAVIS = "true";
expect(detect().service).to.eql('travis')
expect(detect().service).to.eql("travis");
process.env.TRAVIS = ''
})
process.env.TRAVIS = "";
});
it("can select local git service if no service is found", function(){
expect(detect().commit).to.match(/^\w{40}$/);
expect(detect().commit).to.eql(git.head());
});
});
it('can select local git service if no service is found', function() {
expect(detect().commit).to.match(/^\w{40}$/)
expect(detect().commit).to.eql(git.head())
})
})

@@ -1,14 +0,20 @@

var git = require("../lib/git");
var execSync = require("child_process").execSync;
var git = require('../lib/git')
var execSync = require('child_process').execSync
describe("Git", function(){
describe('Git', function() {
it('can get the branch', function() {
expect(git.branch()).to.eql(
execSync('git rev-parse --abbrev-ref HEAD || hg branch')
.toString()
.trim()
)
})
it("can get the branch", function(){
expect(git.branch()).to.eql(execSync("git rev-parse --abbrev-ref HEAD || hg branch").toString().trim());
});
it("can get the head", function(){
expect(git.head()).to.eql(execSync("git log -1 --pretty=%H || hg id -i --debug | tr -d '+'").toString().trim());
});
});
it('can get the head', function() {
expect(git.head()).to.eql(
execSync("git log -1 --pretty=%H || hg id -i --debug | tr -d '+'")
.toString()
.trim()
)
})
})

@@ -53,4 +53,4 @@ var fs = require('fs')

dump: true,
file: 'test' + pathSeparator + 'example.coverage.txt'
}
file: 'test' + pathSeparator + 'example.coverage.txt',
},
})

@@ -148,4 +148,4 @@ expect(res.files[0].split(pathSeparator).pop()).to.eql(

'gcov-exec': 'llvm-gcov',
'gcov-args': '-o'
}
'gcov-args': '-o',
},
})

@@ -152,0 +152,0 @@ if (!isWindows) {

@@ -1,31 +0,29 @@

var appveyor = require("../../lib/services/appveyor");
var appveyor = require('../../lib/services/appveyor')
describe("AppVeyor CI Provider", function(){
describe('AppVeyor CI Provider', function() {
it('can detect appveyor', function() {
process.env.APPVEYOR = 'true'
expect(appveyor.detect()).to.be(true)
})
it ("can detect appveyor", function(){
process.env.APPVEYOR = "true";
expect(appveyor.detect()).to.be(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'
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()).to.eql({
service : 'appveyor',
commit : '5678',
build : 'build',
job : 'a/b/job',
pr : '1',
branch : 'master',
slug : 'owner/repo'
});
});
});
service: 'appveyor',
commit: '5678',
build: 'build',
job: 'a/b/job',
pr: '1',
branch: 'master',
slug: 'owner/repo',
})
})
})

@@ -1,27 +0,25 @@

var buildkite = require("../../lib/services/buildkite");
var buildkite = require('../../lib/services/buildkite')
describe("Buildkite CI Provider", function(){
describe('Buildkite CI Provider', function() {
it('can detect buildkite', function() {
process.env.BUILDKITE = 'true'
expect(buildkite.detect()).to.be(true)
})
it ("can detect buildkite", function(){
process.env.BUILDKITE = "true";
expect(buildkite.detect()).to.be(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'
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()).to.eql({
service : 'buildkite',
build : "1",
build_url : "url",
commit : "commit",
branch : "branch",
slug : "slug"
});
});
});
service: 'buildkite',
build: '1',
build_url: 'url',
commit: 'commit',
branch: 'branch',
slug: 'slug',
})
})
})

@@ -1,64 +0,63 @@

var circle = require("../../lib/services/circle");
var circle = require('../../lib/services/circle')
describe("Circle CI Provider", function(){
describe('Circle CI Provider', function() {
it('can detect circle', function() {
process.env.CIRCLECI = 'true'
expect(circle.detect()).to.be(true)
})
it ("can detect circle", function(){
process.env.CIRCLECI = "true";
expect(circle.detect()).to.be(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';
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()).to.eql({
service : 'circleci',
commit : '5678',
build : '1234.1',
job : '1234.1',
branch : 'master',
pr : 'blah',
slug : 'owner/repo'
});
});
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;
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()).to.eql({
service : 'circleci',
commit : 'abcd',
build : '1234.1',
job : '1234.1',
branch : 'master',
pr : undefined,
slug : 'owner/repo'
});
});
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();
}).to.throwError();
});
});
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()
}).to.throwError()
})
})

@@ -1,25 +0,23 @@

var codeship = require("../../lib/services/codeship");
var codeship = require('../../lib/services/codeship')
describe("Codeship CI Provider", function(){
describe('Codeship CI Provider', function() {
it('can detect codeship', function() {
process.env.CI_NAME = 'codeship'
expect(codeship.detect()).to.be(true)
})
it ("can detect codeship", function(){
process.env.CI_NAME = "codeship";
expect(codeship.detect()).to.be(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://...'
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()).to.eql({
service : 'codeship',
commit : '5678',
build : '1234',
branch : 'master',
build_url : 'https://...'
});
});
});
service: 'codeship',
commit: '5678',
build: '1234',
branch: 'master',
build_url: 'https://...',
})
})
})

@@ -1,26 +0,24 @@

var drone = require("../../lib/services/drone");
var git = require("../../lib/git");
var drone = require('../../lib/services/drone')
var git = require('../../lib/git')
describe("Drone.io CI Provider", function(){
describe('Drone.io CI Provider', function() {
it('can detect drone', function() {
process.env.DRONE = 'true'
expect(drone.detect()).to.be(true)
})
it ("can detect drone", function(){
process.env.DRONE = "true";
expect(drone.detect()).to.be(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 = '/';
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()).to.eql({
service : 'drone.io',
commit : git.head(),
build : '1234',
root : '/',
branch : 'master',
build_url : 'https://...'
});
});
});
service: 'drone.io',
commit: git.head(),
build: '1234',
root: '/',
branch: 'master',
build_url: 'https://...',
})
})
})

@@ -1,25 +0,24 @@

var gitlab = require("../../lib/services/gitlab");
var gitlab = require('../../lib/services/gitlab')
describe("Gitlab CI Provider", function(){
describe('Gitlab CI Provider', function() {
it('can detect gitlab', function() {
process.env.GITLAB_CI = 'true'
expect(gitlab.detect()).to.be(true)
})
it ("can detect gitlab", function(){
process.env.GITLAB_CI = "true";
expect(gitlab.detect()).to.be(true);
});
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 = '/';
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()).to.eql({
service : 'gitlab',
build : '1234',
root : '/',
commit : '5678',
slug : 'owner/repo',
branch : 'master'
});
});
});
service: 'gitlab',
build: '1234',
root: '/',
commit: '5678',
slug: 'owner/repo',
branch: 'master',
})
})
})

@@ -1,65 +0,64 @@

var jenkins = require("../../lib/services/jenkins");
var git = require("../../lib/git");
var jenkins = require('../../lib/services/jenkins')
var git = require('../../lib/git')
describe("Jenkins CI Provider", function(){
describe('Jenkins CI Provider', function() {
it('can detect jenkins', function() {
process.env.JENKINS_URL = 'http://jenkins.jenkins.example/'
expect(jenkins.detect()).to.be(true)
})
it ("can detect jenkins", function(){
process.env.JENKINS_URL = "http://jenkins.jenkins.example/";
expect(jenkins.detect()).to.be(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 = '/';
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()).to.eql({
service : 'jenkins',
build_url : 'http://asdf/',
build : '1234',
root : '/',
commit : '5678',
pr : undefined,
branch : 'master'
});
});
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 = '/';
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()).to.eql({
service : 'jenkins',
build_url : 'http://asdf/',
build : '1234',
root : '/',
commit : git.head(),
pr : undefined,
branch : 'master'
});
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 = '/';
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()).to.eql({
service : 'jenkins',
build_url : 'http://asdf/',
build : '1234',
root : '/',
commit : '8765',
pr : '1111',
branch : 'retsam'
});
});
});
service: 'jenkins',
build_url: 'http://asdf/',
build: '1234',
root: '/',
commit: '8765',
pr: '1111',
branch: 'retsam',
})
})
})

@@ -1,15 +0,17 @@

var local = require("../../lib/services/localGit");
var execSync = require('child_process').execSync;
var local = require('../../lib/services/localGit')
var execSync = require('child_process').execSync
describe("Local git/mercurial CI Provider", function(){
describe('Local git/mercurial CI Provider', function() {
it('can get commit', function() {
expect(local.configuration().commit).to.match(/^\w{40}$/)
expect(local.configuration().commit).to.eql(
execSync("git rev-parse HEAD || hg id -i --debug | tr -d '+'")
.toString()
.trim()
)
})
it ("can get commit", function(){
expect(local.configuration().commit).to.match(/^\w{40}$/);
expect(local.configuration().commit).to.eql(execSync("git rev-parse HEAD || hg id -i --debug | tr -d '+'").toString().trim());
});
it ("can get branch", function(){
expect(local.configuration().branch).to.not.eql(null);
});
});
it('can get branch', function() {
expect(local.configuration().branch).to.not.eql(null)
})
})

@@ -1,25 +0,23 @@

var semaphore = require("../../lib/services/semaphore");
var semaphore = require('../../lib/services/semaphore')
describe("Semaphore CI Provider", function(){
describe('Semaphore CI Provider', function() {
it('can detect semaphore', function() {
process.env.SEMAPHORE = 'true'
expect(semaphore.detect()).to.be(true)
})
it ("can detect semaphore", function(){
process.env.SEMAPHORE = "true";
expect(semaphore.detect()).to.be(true);
});
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";
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()).to.eql({
service : 'semaphore',
commit : '5678',
build : '1234.1',
branch : 'master',
slug : 'owner/repo'
});
});
});
service: 'semaphore',
commit: '5678',
build: '1234.1',
branch: 'master',
slug: 'owner/repo',
})
})
})

@@ -1,29 +0,27 @@

var shippable = require("../../lib/services/shippable");
var shippable = require('../../lib/services/shippable')
describe("Shippable CI Provider", function(){
it ("can detect shippable", function(){
process.env.SHIPPABLE = "true";
expect(shippable.detect()).to.be(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';
describe('Shippable CI Provider', function() {
it('can detect shippable', function() {
process.env.SHIPPABLE = 'true'
expect(shippable.detect()).to.be(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()).to.eql({
service : 'shippable',
commit : '5678',
build : '91011',
build_url : 'http://...',
branch : 'master',
pr : '2',
slug : 'owner/repo'
});
});
});
service: 'shippable',
commit: '5678',
build: '91011',
build_url: 'http://...',
branch: 'master',
pr: '2',
slug: 'owner/repo',
})
})
})

@@ -1,41 +0,40 @@

var snap = require("../../lib/services/snap");
var snap = require('../../lib/services/snap')
describe("Snap CI Provider", function(){
describe('Snap CI Provider', function() {
it('can detect snap', function() {
process.env.SNAP_CI = 'true'
expect(snap.detect()).to.be(true)
})
it ("can detect snap", function(){
process.env.SNAP_CI = "true";
expect(snap.detect()).to.be(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';
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()).to.eql({
service : 'snap',
commit : '5678',
build : '1234',
branch : 'master',
pr : 'blah'
});
});
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';
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()).to.eql({
service : 'snap',
commit : '5678',
build : '1234',
branch : 'upstream-branch',
pr : 'blah'
});
});
});
service: 'snap',
commit: '5678',
build: '1234',
branch: 'upstream-branch',
pr: 'blah',
})
})
})

@@ -1,30 +0,28 @@

var travis = require("../../lib/services/travis");
var travis = require('../../lib/services/travis')
describe("Travis CI Provider", function(){
it ("can detect travis", function(){
process.env.TRAVIS = "true";
expect(travis.detect()).to.be(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';
describe('Travis CI Provider', function() {
it('can detect travis', function() {
process.env.TRAVIS = 'true'
expect(travis.detect()).to.be(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()).to.eql({
service : 'travis',
commit : '5678',
build : '91011',
branch : 'master',
root : '/',
job : '1234',
pr : 'blah',
slug : 'owner/repo'
});
});
});
service: 'travis',
commit: '5678',
build: '91011',
branch: 'master',
root: '/',
job: '1234',
pr: 'blah',
slug: 'owner/repo',
})
})
})

@@ -1,27 +0,25 @@

var wercker = require("../../lib/services/wercker");
var wercker = require('../../lib/services/wercker')
describe("Wercker CI Provider", function(){
describe('Wercker CI Provider', function() {
it('can detect wercker', function() {
process.env.WERCKER_MAIN_PIPELINE_STARTED = '1399372237'
expect(wercker.detect()).to.be(true)
})
it ("can detect wercker", function(){
process.env.WERCKER_MAIN_PIPELINE_STARTED = "1399372237";
expect(wercker.detect()).to.be(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';
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()).to.eql({
service : 'wercker',
commit : '5678',
build : '1399372237',
branch : 'master',
build_url : 'https://...',
slug : 'owner/repo'
});
});
});
service: 'wercker',
commit: '5678',
build: '1399372237',
branch: 'master',
build_url: 'https://...',
slug: 'owner/repo',
})
})
})

@@ -1,113 +0,133 @@

var fs = require('fs');
var codecov = require('../lib/codecov');
var offlineErrors = require('../lib/offline');
var fs = require('fs')
var codecov = require('../lib/codecov')
var offlineErrors = require('../lib/offline')
describe("Codecov", function(){
beforeEach(function(){
describe('Codecov', function() {
beforeEach(function() {
try {
fs.unlinkSync('report.tmp');
fs.unlinkSync('report.tmp')
} catch (e) {}
});
})
after(function(){
after(function() {
try {
fs.unlinkSync('report.tmp');
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).to.contain('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 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).to.contain(
'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 remove files after uploading", function(done){
fs.writeFileSync('report.tmp', '<content>');
expect(fs.exists('report.tmp')).to.be.true;
it('can remove files after uploading', function(done) {
fs.writeFileSync('report.tmp', '<content>')
fs.exists('report.tmp', function(exists) {
expect(exists).to.be.true
})
var self = this;
codecov.sendToCodecovV2('https://codecov.io',
{
token: 'f881216b-b5c0-4eb1-8f21-b51887d1d506',
commit: 'c739768fcac68144a3a6d82305b9c4106934d31a',
file: 'report.tmp',
clear: true,
branch: 'master'
},
'testing node-'+codecov.version,
function(body){
expect(body).to.contain('https://codecov.io/github/codecov/ci-repo/commit/c739768fcac68144a3a6d82305b9c4106934d31a');
expect(fs.exists('report.tmp')).to.be.false;
done();
},
function(errCode, errMsg){
if(offlineErrors.indexOf(errCode) !== -1){
self.skip(); // offline - we can not test upload
return;
}
throw new Error(errMsg);
});
});
var self = this
codecov.sendToCodecovV2(
'https://codecov.io',
{
token: 'f881216b-b5c0-4eb1-8f21-b51887d1d506',
commit: 'c739768fcac68144a3a6d82305b9c4106934d31a',
file: 'report.tmp',
clear: true,
branch: 'master',
},
'testing node-' + codecov.version,
function(body) {
expect(body).to.contain(
'https://codecov.io/github/codecov/ci-repo/commit/c739768fcac68144a3a6d82305b9c4106934d31a'
)
fs.exists('report.tmp', function(exists) {
expect(exists).to.be.false
})
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;
this.timeout(3000); // 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).to.contain('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
this.timeout(3000) // 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).to.contain(
'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).to.contain('https://codecov.io/github/codecov/ci-repo/commit/c739768fcac68144a3a6d82305b9c4106934d31a');
done();
},
function(errCode, errMsg){
if(offlineErrors.indexOf(errCode) !== -1){
done();
}
throw new Error(errMsg);
}
)).to.not.throwException();
});
});
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).to.contain(
'https://codecov.io/github/codecov/ci-repo/commit/c739768fcac68144a3a6d82305b9c4106934d31a'
)
done()
},
function(errCode, errMsg) {
if (offlineErrors.indexOf(errCode) !== -1) {
done()
}
throw new Error(errMsg)
}
)
).to.not.throwException()
})
})

@@ -1,1 +0,1 @@

expect = require('expect.js');
expect = require('expect.js')

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc