Skip to content

Commit 0379eab

Browse files
committed
fix(install): ignore auditLevel
`npm install` should not be affected by the `auditLevel` config, as the results of audit do not change its exit status. PR-URL: #2929 Credit: @wraithgar Close: #2929 Reviewed-by: @ljharb, @ruyadorno
1 parent c0b392c commit 0379eab

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

lib/install.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,15 @@ class Install extends BaseCommand {
126126
if (this.npm.config.get('dev'))
127127
log.warn('install', 'Usage of the `--dev` option is deprecated. Use `--include=dev` instead.')
128128

129-
const arb = new Arborist({
129+
const opts = {
130130
...this.npm.flatOptions,
131+
auditLevel: null,
131132
path: where,
132-
})
133-
134-
await arb.reify({
135-
...this.npm.flatOptions,
136133
add: args,
137-
})
134+
}
135+
const arb = new Arborist(opts)
136+
await arb.reify(opts)
137+
138138
if (!args.length && !isGlobalInstall && !ignoreScripts) {
139139
const scriptShell = this.npm.config.get('script-shell') || undefined
140140
const scripts = [

test/lib/install.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ test('should install using Arborist', (t) => {
3232

3333
const npm = mockNpm({
3434
config: { dev: true },
35-
flatOptions: { global: false },
35+
flatOptions: { global: false, auditLevel: 'low' },
3636
globalDir: 'path/to/node_modules/',
3737
prefix: 'foo',
3838
})
@@ -42,7 +42,9 @@ test('should install using Arborist', (t) => {
4242
install.exec(['fizzbuzz'], er => {
4343
if (er)
4444
throw er
45-
t.match(ARB_ARGS, { global: false, path: 'foo' })
45+
t.match(ARB_ARGS,
46+
{ global: false, path: 'foo', auditLevel: null },
47+
'Arborist gets correct args and ignores auditLevel')
4648
t.equal(REIFY_CALLED, true, 'called reify')
4749
t.strictSame(SCRIPTS, [], 'no scripts when adding dep')
4850
t.end()

0 commit comments

Comments
 (0)