Foreman running guard with color ouput
Asked Answered
P

3

7

I can run guard from within my foreman procfile - but the output is not as colorful as I'd like. The only color I see in my output is from Foreman...

I want to have a guardfile that manages rspec, cucumber and jasmine - AND have that nice color output when those tests run.

It would seem as if foreman ignores guard file settings. Any idea how to change that?

Paramatta answered 6/2, 2012 at 2:25 Comment(0)
N
12

Add the --tty option to your rspec guard cli:

guard "rspec", :version => 2, :cli => "--tty ...other options..."
Nadaha answered 19/4, 2012 at 14:10 Comment(1)
Many thanks! This was very helpful. It turned out it's not enough when using guard-rspec to use just --color, you (at least I saw this) MUST specify --tty also. This is on OS X.Spermatozoid
S
2

For version 4.5.0 of guard-rspec the following worked for me

guard :rspec, cmd_additional_args: "--tty", cmd: ...other...
Shetler answered 6/7, 2015 at 11:35 Comment(0)
M
0

EDIT: Even simpler, in Guardfile do

guard :rspec, cmd: "rspec --force-color"

# In case you do --profile and dot in regular .rspec, you may want to override further:
guard :rspec, cmd: "rspec --force-color --no-profile --format documentation"

/EDIT

I struggled with this and got it running with RSpec 3.8, rails 5.2 and foreman 0.64

Two configs must be done to make it work.

# In .rspec, add
--color

# In Guardfile, change to
guard :rspec, cmd: "rspec --tty" do

It's confusing why --color and tty are needed, the official rspec documentation says that both tty and color are default enabled.

Endnote: if you are doing this, running guard with foreman, it tells me a lot about what kind of developer you are. Say no more ;)

Mcswain answered 1/10, 2018 at 8:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.