diff --git a/garden-service/test/e2e-helpers.ts b/garden-service/test/e2e-helpers.ts index 22506deb1e..bb6f7804dd 100644 --- a/garden-service/test/e2e-helpers.ts +++ b/garden-service/test/e2e-helpers.ts @@ -1,5 +1,5 @@ +import chalk from "chalk" import execa from "execa" -import mlog from "mocha-logger" import { remove } from "fs-extra" import { get, intersection, padEnd } from "lodash" import parseArgs = require("minimist") @@ -70,8 +70,8 @@ export function parseLogEntries(entries: string[]): JsonLogEntry[] { try { return JSON.parse(line) } catch (error) { - mlog.log("Unable to parse line", line) - return {} + // Unable to parse line, so we assume it's a line from an error message. + return { msg: chalk.red(line) } } }) } diff --git a/garden-service/test/run-garden.ts b/garden-service/test/run-garden.ts index 34f249049c..5d424aeb83 100644 --- a/garden-service/test/run-garden.ts +++ b/garden-service/test/run-garden.ts @@ -101,10 +101,10 @@ export function commandReloadedStep(): WatchTestStep { } } -function stringifyJsonLog(entries: UpdateLogEntryParams[]) { +function stringifyJsonLog(entries: UpdateLogEntryParams[], opts = { error: false }) { return entries .map((l) => { - const msg = chalk.white(<string>l.msg || "") + const msg = (opts.error ? chalk.red : chalk.white)(<string>l.msg || "") return l.section ? `${chalk.cyanBright(l.section)}${chalk.gray(":")} ${msg}` : msg }) .join("\n") @@ -128,7 +128,7 @@ export async function runGarden(dir: string, command: string[]): Promise<JsonLog let msg = err.message.split("\n")[0] if (err.stdout) { const parsedLog = parseLogEntries(err.stdout.split("\n").filter(Boolean)) - msg += "\n" + stringifyJsonLog(parsedLog) + msg += "\n" + stringifyJsonLog(parsedLog, { error: true }) } throw new Error(`Failed running command '${command.join(" ")}': ${msg}`) }