问题
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?
回答1:
Add the --tty option to your rspec guard cli:
guard "rspec", :version => 2, :cli => "--tty ...other options..."
回答2:
For version 4.5.0 of guard-rspec
the following worked for me
guard :rspec, cmd_additional_args: "--tty", cmd: ...other...
回答3:
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 ;)
来源:https://stackoverflow.com/questions/9154982/foreman-running-guard-with-color-ouput