Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

super_diff removes most rspec color output when run with parallel_tests #201

Closed
fwolfst opened this issue Oct 26, 2023 · 3 comments
Closed

Comments

@fwolfst
Copy link

fwolfst commented Oct 26, 2023

We use parallel_tests with rspec and rails. Once super_diff/rspec is required, most colors are stripped from the output. :(

When uncommenting Core::Formatters::ConsoleCodes (in monkey_patches.rb), the color comes back (but is gone in the colorful diff).

Seems to be in the console_code_for + wrap part, the only location I found (and I am wildly guessing here, do not understand the colorization), is in parallel_tests FailureLogger: https://github.com/search?q=repo%3Agrosser%2Fparallel_tests%20consolecodes&type=code .

@fwolfst
Copy link
Author

fwolfst commented Oct 26, 2023

🤦 Seems that enabling the colors via

# rails_helper.rb
SuperDiff.configure do |config|
  config.color_enabled = true
end

solves the issue. Still strange that without parallel rspec this setting was not necessary. My problem is gone however, so can be closed if no bells ring.

@pheisiph
Copy link

pheisiph commented Nov 3, 2023

I suspect the following returns false as the spec suite itself does not run in a TTY session, when invoked by parallel_tests

    # lib/super_diff/configuration.rb#145
    def color_enabled_by_default?
      ENV["CI"] == "true" || $stdout.respond_to?(:tty?) && $stdout.tty?
    end

@jas14
Copy link
Collaborator

jas14 commented Sep 22, 2024

Hi @fwolfst , I'm revisiting some open issues right now.

As of #261, we're mostly adopting RSpec's automatic color mode. I see that parallel_tests requests colorized output from RSpec when it itself is run in a TTY, so as of the next release, this should be fixed. Please feel free to comment on the issue again if that's not the case. You can test it out by pointing your gemspec to the main branch on this repo.

@jas14 jas14 closed this as completed Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants