diff options
| author | XhmikosR <[email protected]> | 2020-04-23 21:08:35 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-04-23 11:08:35 -0700 |
| commit | 3647673f9e43ea973ebed65a891e897415cb2389 (patch) | |
| tree | 23d34a1565e8dc75b1f5623c4ea6846eb2b6738c /lib | |
| parent | ff21930515e15e367a3d033230d0c5def75fc206 (diff) | |
| download | node-coveralls-3647673f9e43ea973ebed65a891e897415cb2389.tar.xz node-coveralls-3647673f9e43ea973ebed65a891e897415cb2389.zip | |
Minor lint tweaks (#285)
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/convertLcovToCoveralls.js | 19 | ||||
| -rw-r--r-- | lib/getOptions.js | 3 |
2 files changed, 16 insertions, 6 deletions
diff --git a/lib/convertLcovToCoveralls.js b/lib/convertLcovToCoveralls.js index 710c87d..416b3b4 100644 --- a/lib/convertLcovToCoveralls.js +++ b/lib/convertLcovToCoveralls.js @@ -7,19 +7,23 @@ const logger = require('./logger')(); const detailsToCoverage = (length, details) => { const coverage = new Array(length); + details.forEach(obj => { coverage[obj.line - 1] = obj.hit; }); + return coverage; }; const detailsToBranches = details => { const branches = []; + details.forEach(obj => { ['line', 'block', 'branch', 'taken'].forEach(key => { branches.push(obj[key] || 0); }); }); + return branches; }; @@ -67,7 +71,7 @@ const convertLcovToCoveralls = (input, options, cb) => { if (options.flag_name) { postJson.flag_name = options.flag_name; } - + if (options.git) { postJson.git = options.git; } @@ -79,11 +83,11 @@ const convertLcovToCoveralls = (input, options, cb) => { if (options.service_name) { postJson.service_name = options.service_name; } - + if (options.service_number) { postJson.service_number = options.service_number; } - + if (options.service_job_id) { postJson.service_job_id = options.service_job_id; } @@ -107,6 +111,7 @@ const convertLcovToCoveralls = (input, options, cb) => { postJson.source_files.push(convertLcovFileObject(file, filepath)); } }); + return cb(null, postJson); }); }; @@ -134,7 +139,7 @@ module.exports = convertLcovToCoveralls; example output from lcov parser: - [ +[ { "file": "index.js", "lines": { @@ -156,6 +161,10 @@ example output from lcov parser: { "line": 5, "hit": 1 - }, + } + ] + } + } +] */ diff --git a/lib/getOptions.js b/lib/getOptions.js index 7fcbf08..2f9c9fb 100644 --- a/lib/getOptions.js +++ b/lib/getOptions.js @@ -180,6 +180,7 @@ const getBaseOptions = cb => { if (coveralls_yaml_conf.repo_token) { options.repo_token = coveralls_yaml_conf.repo_token; } + if (coveralls_yaml_conf.service_name) { options.service_name = coveralls_yaml_conf.service_name; } @@ -190,7 +191,7 @@ const getBaseOptions = cb => { options.repo_token = process.env.COVERALLS_REPO_TOKEN; } - if ('travis-pro' === options.service_name && !options.repo_token) { + if (options.service_name === 'travis-pro' && !options.repo_token) { logger.warn('Repo token could not be determined. Continuing without it. ' + 'This is necessary for private repos only, so may not be an issue at all.'); } |
