@@ -17,7 +17,9 @@ const providers = require('./ci_providers')
17
17
function dryRun ( uploadHost , token , query , uploadFile , source ) {
18
18
log ( '==> Dumping upload file (no upload)' )
19
19
log (
20
- `${ uploadHost } /upload/v4?package=${ webHelpers . getPackage ( source ) } &token=${ token } &${ query } ` ,
20
+ `${ uploadHost } /upload/v4?package=${ webHelpers . getPackage (
21
+ source ,
22
+ ) } &token=${ token } &${ query } `,
21
23
)
22
24
log ( uploadFile )
23
25
}
@@ -69,8 +71,11 @@ async function main(args) {
69
71
let token = validateHelpers . validateToken ( args . token ) ? args . token : ''
70
72
if ( token === '' ) {
71
73
token = process . env . CODECOV_TOKEN || ''
74
+ token = validateHelpers . validateToken ( process . env . CODECOV_TOKEN )
75
+ ? process . env . CODECOV_TOKEN
76
+ : ''
72
77
}
73
- token = args . token || process . env . CODECOV_TOKEN || ''
78
+
74
79
log ( generateHeader ( getVersion ( ) ) )
75
80
76
81
// == Step 2: detect if we are in a git repo
@@ -120,14 +125,14 @@ async function main(args) {
120
125
)
121
126
}
122
127
} else {
123
- if ( typeof ( args . file ) === 'string' ) {
128
+ if ( typeof args . file === 'string' ) {
124
129
coverageFilePaths = [ args . file ]
125
130
} else {
126
131
coverageFilePaths = args . file
127
132
}
128
133
129
- coverageFilePaths . filter ( ( file ) => {
130
- return validateHelpers . validateFileNamePath ( file ) ;
134
+ coverageFilePaths . filter ( file => {
135
+ return validateHelpers . validateFileNamePath ( file )
131
136
} )
132
137
if ( coverageFilePaths . length === 0 ) {
133
138
throw new Error ( 'No coverage files found, exiting.' )
@@ -143,13 +148,13 @@ async function main(args) {
143
148
let fileContents
144
149
try {
145
150
log ( `Processing ${ coverageFile } ...` ) ,
146
- fileContents = await fileHelpers . readCoverageFile (
147
- args . dir || projectRoot ,
148
- coverageFile ,
149
- )
151
+ ( fileContents = await fileHelpers . readCoverageFile (
152
+ args . dir || projectRoot ,
153
+ coverageFile ,
154
+ ) )
150
155
} catch ( error ) {
151
156
log ( `Could not read coverage file (${ coverageFile } ): ${ error } ` )
152
- continue ;
157
+ continue
153
158
}
154
159
155
160
uploadFile = uploadFile
@@ -207,11 +212,15 @@ async function main(args) {
207
212
}
208
213
209
214
log (
210
- `Pinging Codecov: ${ uploadHost } /upload/v4?package=${ webHelpers . getPackage ( args . source ) } &token=*******&${ query } ` ,
215
+ `Pinging Codecov: ${ uploadHost } /upload/v4?package=${ webHelpers . getPackage (
216
+ args . source ,
217
+ ) } &token=*******&${ query } `,
211
218
)
212
219
try {
213
220
log (
214
- `${ uploadHost } /upload/v4?package=${ webHelpers . getPackage ( args . source ) } &${ query }
221
+ `${ uploadHost } /upload/v4?package=${ webHelpers . getPackage (
222
+ args . source ,
223
+ ) } &${ query }
215
224
Content-Type: 'text/plain'
216
225
Content-Encoding: 'gzip'
217
226
X-Reduced-Redundancy: 'false'` ,
0 commit comments