@@ -104,7 +104,7 @@ function maybeReadFile (name) {
104
104
}
105
105
} )
106
106
. catch ( { code : 'ENOENT' } , ( ) => null )
107
- . catch ( ex => {
107
+ . catch ( ( ex ) => {
108
108
ex . file = file
109
109
throw ex
110
110
} )
@@ -156,7 +156,7 @@ function auditCmd (args, cb) {
156
156
( pkgJson && pkgJson . dependencies ) || { } ,
157
157
( pkgJson && pkgJson . devDependencies ) || { }
158
158
)
159
- return lockVerify ( npm . prefix ) . then ( result => {
159
+ return lockVerify ( npm . prefix ) . then ( ( result ) => {
160
160
if ( result . status ) return audit . generate ( sw , requires )
161
161
162
162
const lockFile = shrinkwrap ? 'npm-shrinkwrap.json' : 'package-lock.json'
@@ -167,7 +167,7 @@ function auditCmd (args, cb) {
167
167
} )
168
168
} ) . then ( ( auditReport ) => {
169
169
return audit . submitForFullReport ( auditReport )
170
- } ) . catch ( err => {
170
+ } ) . catch ( ( err ) => {
171
171
if ( err . statusCode === 404 || err . statusCode >= 500 ) {
172
172
const ne = new Error ( `Your configured registry (${ npm . config . get ( 'registry' ) } ) does not support audit requests.` )
173
173
ne . code = 'ENOAUDIT'
@@ -262,7 +262,11 @@ function auditCmd (args, cb) {
262
262
auditResult . metadata . vulnerabilities . high +
263
263
auditResult . metadata . vulnerabilities . critical
264
264
if ( vulns > 0 ) process . exitCode = 1
265
- return audit . printFullReport ( auditResult )
265
+ if ( npm . config . get ( 'parseable' ) ) {
266
+ return audit . printParseableReport ( auditResult )
267
+ } else {
268
+ return audit . printFullReport ( auditResult )
269
+ }
266
270
}
267
271
} ) . asCallback ( cb )
268
272
}
0 commit comments