Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

How can you force color without tty? #665

@alexcoplan

Description

@alexcoplan

I'm running rspec manually (without the rspec command), and I want to set the color configuration to true.

I've tried:

RSpec.configure do |c|
  c.tty = true
  c.color = true
end

p RSpec.configuration.tty? # => true
p RSpec.configuration.color? # => false

And as you can see that doesn't work.

Looking at the output_to_tty? method:

def output_to_tty?
  begin
    output_stream.tty? || tty?
  rescue NoMethodError
    false
  end
end

I'm guessing that it's throwing NoMethodError on output_stream.tty? and returning false - therefore, color can't be enabled, since the color option depends on this method returning true.

So how can I (with code), force the color configuration to true?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions