From 5f6beb8ba1281968e0a016e5a7710c144fc5a981 Mon Sep 17 00:00:00 2001 From: Gar Date: Wed, 10 Nov 2021 08:30:39 -0800 Subject: [PATCH] fix: command completion The fake npm object in the tests wasn't returning an async function Fixes: https://github.com/npm/cli/issues/4020 --- lib/commands/completion.js | 2 +- test/lib/commands/completion.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/commands/completion.js b/lib/commands/completion.js index bce6c3619ccc4..17de3f8af7481 100644 --- a/lib/commands/completion.js +++ b/lib/commands/completion.js @@ -166,7 +166,7 @@ class Completion extends BaseCommand { // at this point, if words[1] is some kind of npm command, // then complete on it. // otherwise, do nothing - const impl = this.npm.cmd(cmd) + const impl = await this.npm.cmd(cmd) if (impl.completion) { const comps = await impl.completion(opts) return this.wrap(opts, comps) diff --git a/test/lib/commands/completion.js b/test/lib/commands/completion.js index 7a7e0a759fbfe..c4addbb291d58 100644 --- a/test/lib/commands/completion.js +++ b/test/lib/commands/completion.js @@ -21,7 +21,7 @@ const npm = { } }, }, - cmd: cmd => { + cmd: async cmd => { return { completion: { completion: () => [['>>', '~/.bashrc']],