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

Open
fwolfst opened this issue Oct 26, 2023 · 2 comments
Open

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

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

2 participants