Skip to content

Commit 1af411c

Browse files
fix: run type-check and correct invalid calls
1 parent 89e6d60 commit 1af411c

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

bin/codecov

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ app
123123
app.verbose(`End of uploader: ${end - start} milliseconds`, argv.verbose)
124124
})
125125
.catch(error => {
126-
app.log(`Error!: ${error}`, { level: 'error', argv })
126+
app.error(`Error!: ${error}`)
127127
const end = Date.now()
128128
app.verbose(`End of uploader: ${end - start} milliseconds`, argv.verbose)
129129
process.exit(argv.nonZero ? -1 : 0)

src/helpers/files.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ function fetchGitRoot() {
196196
).trimRight()
197197
} catch (error) {
198198
logAndThrow('Error fetching git root. Please try using the -R flag.')
199+
return '.'
199200
}
200201
}
201202

@@ -206,7 +207,8 @@ function fetchGitRoot() {
206207
*/
207208
function parseGitIgnore(projectRoot) {
208209
const gitIgnorePath = path.join(projectRoot, '.gitignore')
209-
let lines
210+
/** @type {string[]} */
211+
let lines = []
210212
try {
211213
lines = readAllLines(gitIgnorePath) || []
212214
} catch (error) {
@@ -226,6 +228,7 @@ function parseGitIgnore(projectRoot) {
226228
* @param {string} projectRoot Root of the project
227229
* @param {string} dirPath Directory to search in
228230
* @param {Object} args
231+
* @param {boolean} [args.verbose]
229232
* @param {string[]} arrayOfFiles
230233
* @returns {string[]}
231234
*/
@@ -280,6 +283,7 @@ function readCoverageFile(projectRoot, filePath) {
280283
} catch (error) {
281284
logAndThrow(`There was an error reading the coverage file: ${error}`)
282285
}
286+
return ''
283287
}
284288

285289
function endNetworkMarker() {

src/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async function main(args) {
9393

9494
if (!args.feature || args.feature.split(',').includes('network') === false) {
9595
verbose('Start of network processing...', args.verbose)
96-
let fileListing
96+
let fileListing = ''
9797
try {
9898
fileListing = await fileHelpers.getFileListing(projectRoot, args)
9999
} catch (error) {
@@ -199,6 +199,7 @@ async function main(args) {
199199

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

204205
// == Step 8: either upload or dry-run
@@ -218,14 +219,14 @@ async function main(args) {
218219
)
219220
verbose(`Passed token was ${token.length} characters long`, args.verbose)
220221
try {
221-
info(
222+
verbose(
222223
`${uploadHost}/upload/v4?package=${webHelpers.getPackage(
223224
args.source,
224225
)}&${query}
225226
Content-Type: 'text/plain'
226227
Content-Encoding: 'gzip'
227228
X-Reduced-Redundancy: 'false'`,
228-
{ level: 'debug', args },
229+
args.verbose,
229230
)
230231

231232
const uploadURL = await webHelpers.uploadToCodecov(

0 commit comments

Comments
 (0)