From 4c96eb94b039d13de69f45839210062642357981 Mon Sep 17 00:00:00 2001 From: ocavue Date: Sun, 17 Jul 2022 11:19:02 +0800 Subject: [PATCH] chore: force turbo to output colors --- packages/cli/src/commands/test.mjs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/commands/test.mjs b/packages/cli/src/commands/test.mjs index 8a17f1e76..fc80bbf39 100644 --- a/packages/cli/src/commands/test.mjs +++ b/packages/cli/src/commands/test.mjs @@ -9,15 +9,20 @@ export function test(testPath, extraArgs) { const absTestPath = path.resolve(process.cwd(), testPath) const packageName = path.relative(root, absTestPath).split(path.sep)[1] const turboBin = findTurboBin() + const env = { + // Force turbo to output colors + FORCE_COLOR: 1, + ...process.env, + } if (packageName) { const args = ["run", "test:vitest", `--filter=${packageName}`, "--", absTestPath, ...extraArgs] console.log("$", turboBin + " " + args.join(" ")) - spawnSync(turboBin, args, { stdio: "inherit", cwd: root }) + spawnSync(turboBin, args, { stdio: "inherit", cwd: root, env }) } else if (root == absTestPath) { const args = ["run", "test:vitest", ...extraArgs] console.log("$", turboBin + " " + args.join(" ")) - spawnSync(turboBin, args, { stdio: "inherit", cwd: root }) + spawnSync(turboBin, args, { stdio: "inherit", cwd: root, env }) } else { throw new Error(`Test path ${absTestPath} must be inside a package`) }