summaryrefslogtreecommitdiff
path: root/deps/npm/test/lib/utils/completion/installed-deep.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/test/lib/utils/completion/installed-deep.js')
-rw-r--r--deps/npm/test/lib/utils/completion/installed-deep.js125
1 files changed, 59 insertions, 66 deletions
diff --git a/deps/npm/test/lib/utils/completion/installed-deep.js b/deps/npm/test/lib/utils/completion/installed-deep.js
index a2a3756104..bd61ab4280 100644
--- a/deps/npm/test/lib/utils/completion/installed-deep.js
+++ b/deps/npm/test/lib/utils/completion/installed-deep.js
@@ -11,7 +11,8 @@ const _flatOptions = {
return prefix
},
}
-const installedDeep = requireInject('../../../../lib/utils/completion/installed-deep.js', {
+const p = '../../../../lib/utils/completion/installed-deep.js'
+const installedDeep = requireInject(p, {
'../../../../lib/npm.js': {
flatOptions: _flatOptions,
get prefix () {
@@ -144,7 +145,7 @@ const globalFixture = {
},
}
-test('get list of package names', (t) => {
+test('get list of package names', async t => {
const fix = t.testdir({
local: fixture,
global: globalFixture,
@@ -153,25 +154,23 @@ test('get list of package names', (t) => {
prefix = resolve(fix, 'local')
globalDir = resolve(fix, 'global/node_modules')
- installedDeep(null, (err, res) => {
- t.ifError(err, 'should not error out')
- t.deepEqual(
- res,
- [
- ['bar', '-g'],
- ['foo', '-g'],
- ['a-bar', '-g'],
- 'a', 'b', 'c',
- 'd', 'e', 'f',
- 'g', 'bb',
- ],
- 'should return list of package names and global flag'
- )
- t.end()
- })
+ const res = await installedDeep(null)
+ t.deepEqual(
+ res,
+ [
+ ['bar', '-g'],
+ ['foo', '-g'],
+ ['a-bar', '-g'],
+ 'a', 'b', 'c',
+ 'd', 'e', 'f',
+ 'g', 'bb',
+ ],
+ 'should return list of package names and global flag'
+ )
+ t.end()
})
-test('get list of package names as global', (t) => {
+test('get list of package names as global', async t => {
const fix = t.testdir({
local: fixture,
global: globalFixture,
@@ -182,23 +181,21 @@ test('get list of package names as global', (t) => {
_flatOptions.global = true
- installedDeep(null, (err, res) => {
- t.ifError(err, 'should not error out')
- t.deepEqual(
- res,
- [
- 'bar',
- 'foo',
- 'a-bar',
- ],
- 'should return list of global packages with no extra flags'
- )
- _flatOptions.global = false
- t.end()
- })
+ const res = await installedDeep(null)
+ t.deepEqual(
+ res,
+ [
+ 'bar',
+ 'foo',
+ 'a-bar',
+ ],
+ 'should return list of global packages with no extra flags'
+ )
+ _flatOptions.global = false
+ t.end()
})
-test('limit depth', (t) => {
+test('limit depth', async t => {
const fix = t.testdir({
local: fixture,
global: globalFixture,
@@ -209,26 +206,24 @@ test('limit depth', (t) => {
_flatOptions.depth = 0
- installedDeep(null, (err, res) => {
- t.ifError(err, 'should not error out')
- t.deepEqual(
- res,
- [
- ['bar', '-g'],
- ['foo', '-g'],
- 'a', 'b',
- 'c', 'd',
- 'e', 'f',
- 'g',
- ],
- 'should print only packages up to the specified depth'
- )
- _flatOptions.depth = 0
- t.end()
- })
+ const res = await installedDeep(null)
+ t.deepEqual(
+ res,
+ [
+ ['bar', '-g'],
+ ['foo', '-g'],
+ 'a', 'b',
+ 'c', 'd',
+ 'e', 'f',
+ 'g',
+ ],
+ 'should print only packages up to the specified depth'
+ )
+ _flatOptions.depth = 0
+ t.end()
})
-test('limit depth as global', (t) => {
+test('limit depth as global', async t => {
const fix = t.testdir({
local: fixture,
global: globalFixture,
@@ -240,18 +235,16 @@ test('limit depth as global', (t) => {
_flatOptions.global = true
_flatOptions.depth = 0
- installedDeep(null, (err, res) => {
- t.ifError(err, 'should not error out')
- t.deepEqual(
- res,
- [
- 'bar',
- 'foo',
- ],
- 'should reorder so that packages above that level depth goes last'
- )
- _flatOptions.global = false
- _flatOptions.depth = 0
- t.end()
- })
+ const res = await installedDeep(null)
+ t.deepEqual(
+ res,
+ [
+ 'bar',
+ 'foo',
+ ],
+ 'should reorder so that packages above that level depth goes last'
+ )
+ _flatOptions.global = false
+ _flatOptions.depth = 0
+ t.end()
})