Skip to content

Commit

Permalink
fix: run type-check and correct invalid calls
Browse files Browse the repository at this point in the history
  • Loading branch information
drazisil-codecov committed Jul 22, 2021
1 parent 89e6d60 commit 1af411c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/codecov
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ app
app.verbose(`End of uploader: ${end - start} milliseconds`, argv.verbose)
})
.catch(error => {
app.log(`Error!: ${error}`, { level: 'error', argv })
app.error(`Error!: ${error}`)
const end = Date.now()
app.verbose(`End of uploader: ${end - start} milliseconds`, argv.verbose)
process.exit(argv.nonZero ? -1 : 0)
Expand Down
6 changes: 5 additions & 1 deletion src/helpers/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ function fetchGitRoot() {
).trimRight()
} catch (error) {
logAndThrow('Error fetching git root. Please try using the -R flag.')
return '.'
}
}

Expand All @@ -206,7 +207,8 @@ function fetchGitRoot() {
*/
function parseGitIgnore(projectRoot) {
const gitIgnorePath = path.join(projectRoot, '.gitignore')
let lines
/** @type {string[]} */
let lines = []
try {
lines = readAllLines(gitIgnorePath) || []
} catch (error) {
Expand All @@ -226,6 +228,7 @@ function parseGitIgnore(projectRoot) {
* @param {string} projectRoot Root of the project
* @param {string} dirPath Directory to search in
* @param {Object} args
* @param {boolean} [args.verbose]
* @param {string[]} arrayOfFiles
* @returns {string[]}
*/
Expand Down Expand Up @@ -280,6 +283,7 @@ function readCoverageFile(projectRoot, filePath) {
} catch (error) {
logAndThrow(`There was an error reading the coverage file: ${error}`)
}
return ''
}

function endNetworkMarker() {
Expand Down
7 changes: 4 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ async function main(args) {

if (!args.feature || args.feature.split(',').includes('network') === false) {
verbose('Start of network processing...', args.verbose)
let fileListing
let fileListing = ''
try {
fileListing = await fileHelpers.getFileListing(projectRoot, args)
} catch (error) {
Expand Down Expand Up @@ -199,6 +199,7 @@ async function main(args) {

if (serviceParams === undefined) {
logAndThrow('Unable to detect service, please specify manually.')
process.exit(args.nonZero ? -1 : 0)
}

// == Step 8: either upload or dry-run
Expand All @@ -218,14 +219,14 @@ async function main(args) {
)
verbose(`Passed token was ${token.length} characters long`, args.verbose)
try {
info(
verbose(
`${uploadHost}/upload/v4?package=${webHelpers.getPackage(
args.source,
)}&${query}
Content-Type: 'text/plain'
Content-Encoding: 'gzip'
X-Reduced-Redundancy: 'false'`,
{ level: 'debug', args },
args.verbose,
)

const uploadURL = await webHelpers.uploadToCodecov(
Expand Down

0 comments on commit 1af411c

Please sign in to comment.