diff --git a/garden-service/src/server/commands.ts b/garden-service/src/server/commands.ts index 8375e9a296..fe49c2649d 100644 --- a/garden-service/src/server/commands.ts +++ b/garden-service/src/server/commands.ts @@ -66,10 +66,6 @@ export async function resolveRequest( // Prepare arguments for command action. const command = commandSpec.command - // TODO: Creating a new Garden instance is not ideal, - // need to revisit once we've refactored the TaskGraph and config resolution. - const cmdGarden = await Garden.factory(garden.projectRoot, garden.opts) - // We generally don't want actions to log anything in the server. const cmdLog = log.placeholder(LogLevel.silly, { childEntriesInheritLevel: true }) @@ -78,7 +74,7 @@ export async function resolveRequest( const cmdOpts = mapParams(ctx, request.parameters, optParams) return command.action({ - garden: cmdGarden, + garden, log: cmdLog, headerLog: cmdLog, footerLog: cmdLog, diff --git a/garden-service/test/unit/src/server/server.ts b/garden-service/test/unit/src/server/server.ts index 7e83dc21bc..18590e5542 100644 --- a/garden-service/test/unit/src/server/server.ts +++ b/garden-service/test/unit/src/server/server.ts @@ -194,6 +194,10 @@ describe("startServer", () => { it("should correctly map arguments and options to commands", (done) => { const id = uuid.v4() onMessage((req) => { + // Ignore other events such as taskPending and taskProcessing and wait for the command result + if ((req).type !== "commandResult") { + return + } const taskResult = taskResultOutputs((req).result) const result = { ...req,