Skip to content

Commit

Permalink
audit: Refuse to run in global mode
Browse files Browse the repository at this point in the history
Credit: @iarna
  • Loading branch information
iarna committed May 5, 2018
1 parent bc3fc55 commit cf09066
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ function maybeReadFile (name) {
}

function auditCmd (args, cb) {
if (npm.config.get('global')) {
const err = new Error('`npm audit` does not support testing globals')
err.code = 'EAUDITGLOBAL'
throw err
}
return Bluebird.all([
maybeReadFile('npm-shrinkwrap.json'),
maybeReadFile('package-lock.json'),
Expand Down

0 comments on commit cf09066

Please sign in to comment.