diff options
Diffstat (limited to 'deps/npm/test/lib/utils/completion/installed-shallow.js')
-rw-r--r-- | deps/npm/test/lib/utils/completion/installed-shallow.js | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/deps/npm/test/lib/utils/completion/installed-shallow.js b/deps/npm/test/lib/utils/completion/installed-shallow.js index 1d6369bc78..1da68810b5 100644 --- a/deps/npm/test/lib/utils/completion/installed-shallow.js +++ b/deps/npm/test/lib/utils/completion/installed-shallow.js @@ -9,7 +9,7 @@ const installed = requireInject(p, { '../../../../lib/npm.js': npm, }) -t.test('global not set, include globals with -g', t => { +t.test('global not set, include globals with -g', async t => { const dir = t.testdir({ global: { node_modules: { @@ -32,21 +32,17 @@ t.test('global not set, include globals with -g', t => { npm.localDir = resolve(dir, 'local/node_modules') flatOptions.global = false const opt = { conf: { argv: { remain: [] } } } - installed(opt, (er, res) => { - if (er) - throw er - - t.strictSame(res.sort(), [ - '@scope/y -g', - 'x -g', - 'a', - '@scope/b', - ].sort()) - t.end() - }) + const res = await installed(opt) + t.strictSame(res.sort(), [ + '@scope/y -g', + 'x -g', + 'a', + '@scope/b', + ].sort()) + t.end() }) -t.test('global set, include globals and not locals', t => { +t.test('global set, include globals and not locals', async t => { const dir = t.testdir({ global: { node_modules: { @@ -69,16 +65,15 @@ t.test('global set, include globals and not locals', t => { npm.localDir = resolve(dir, 'local/node_modules') flatOptions.global = true const opt = { conf: { argv: { remain: [] } } } - installed(opt, (er, res) => { - t.strictSame(res.sort(), [ - '@scope/y', - 'x', - ].sort()) - t.end() - }) + const res = await installed(opt) + t.strictSame(res.sort(), [ + '@scope/y', + 'x', + ].sort()) + t.end() }) -t.test('more than 3 items in argv, skip it', t => { +t.test('more than 3 items in argv, skip it', async t => { const dir = t.testdir({ global: { node_modules: { @@ -101,11 +96,7 @@ t.test('more than 3 items in argv, skip it', t => { npm.localDir = resolve(dir, 'local/node_modules') flatOptions.global = false const opt = { conf: { argv: { remain: [1, 2, 3, 4, 5, 6] } } } - installed(opt, (er, res) => { - if (er) - throw er - - t.strictSame(res, null) - t.end() - }) + const res = await installed(opt) + t.strictSame(res, null) + t.end() }) |