From 993963e2ee1c24dee0f39dbdbb3283272c30679c Mon Sep 17 00:00:00 2001 From: Ruy Adorno Date: Mon, 1 Mar 2021 11:38:43 -0500 Subject: deps: upgrade npm to 7.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/37559 Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott Reviewed-By: Michaƫl Zasso --- deps/npm/test/lib/profile.js | 47 +++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 29 deletions(-) (limited to 'deps/npm/test/lib/profile.js') diff --git a/deps/npm/test/lib/profile.js b/deps/npm/test/lib/profile.js index 48a558cace..3b2e140036 100644 --- a/deps/npm/test/lib/profile.js +++ b/deps/npm/test/lib/profile.js @@ -1398,17 +1398,16 @@ t.test('unknown subcommand', t => { t.test('completion', t => { const { completion } = profile - const testComp = ({ t, argv, expect, title }) => { - completion({ conf: { argv: { remain: argv } } }, (err, res) => { - if (err) - throw err - - t.strictSame(res, expect, title) - }) + const testComp = async ({ t, argv, expect, title }) => { + t.resolveMatch( + completion({ conf: { argv: { remain: argv } } }), + expect, + title + ) } - t.test('npm profile autocomplete', t => { - testComp({ + t.test('npm profile autocomplete', async t => { + await testComp({ t, argv: ['npm', 'profile'], expect: ['enable-2fa', 'disable-2fa', 'get', 'set'], @@ -1418,8 +1417,8 @@ t.test('completion', t => { t.end() }) - t.test('npm profile enable autocomplete', t => { - testComp({ + t.test('npm profile enable autocomplete', async t => { + await testComp({ t, argv: ['npm', 'profile', 'enable-2fa'], expect: ['auth-and-writes', 'auth-only'], @@ -1429,10 +1428,10 @@ t.test('completion', t => { t.end() }) - t.test('npm profile no autocomplete', t => { + t.test('npm profile no autocomplete', async t => { const noAutocompleteCmds = ['disable-2fa', 'disable-tfa', 'get', 'set'] for (const subcmd of noAutocompleteCmds) { - testComp({ + await testComp({ t, argv: ['npm', 'profile', subcmd], expect: [], @@ -1443,22 +1442,12 @@ t.test('completion', t => { t.end() }) - t.test('npm profile unknown subcommand autocomplete', t => { - completion({ - conf: { - argv: { - remain: ['npm', 'profile', 'asdf'], - }, - }, - }, (err, res) => { - t.match( - err, - /asdf not recognized/, - 'should throw unknown cmd error' - ) - - t.end() - }) + t.test('npm profile unknown subcommand autocomplete', async t => { + t.rejects( + completion({ conf: { argv: { remain: ['npm', 'profile', 'asdf'] } } }), + { message: 'asdf not recognized' }, 'should throw unknown cmd error' + ) + t.end() }) t.end() -- cgit v1.2.1