Skip to content

Commit

Permalink
chore: force turbo to output colors
Browse files Browse the repository at this point in the history
  • Loading branch information
ocavue committed Jul 17, 2022
1 parent d5d4a01 commit 4c96eb9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/cli/src/commands/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
}
Expand Down

0 comments on commit 4c96eb9

Please sign in to comment.