Conversation
c63d627 to
5973858
Compare
--force-color (and the default Split by Test Examples)
ArturT
approved these changes
Apr 16, 2025
3v0k4
added a commit
to KnapsackPro/docs.knapsackpro.com
that referenced
this pull request
Apr 17, 2025
The logged error is more readable now: KnapsackPro/knapsack_pro-ruby#298
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Story
https://trello.com/c/KmjAHr7U/688-bugknapsackpro-force-color-option-breaks-knapsack-pro
Description
Running Knapsack Pro for RSpec with
--force-color(and the default Split by Test Examples) does not work because when generating the report, Knapsack Pro passes--no-color:knapsack_pro-ruby/lib/knapsack_pro/test_case_detectors/rspec_test_example_detector.rb
Line 36 in 7ec77c8
And RSpec
aborts in such situations:https://github.com/rspec/rspec/blob/d064fd0e9f00af834dfcfbe55e74b066a76e98e6/rspec-core/lib/rspec/core/option_parser.rb#L148-L160
The
--no-colorwas added in #275.This PR removes the
--no-colorfix (so users can use either--no-coloror--force-color) and instead prints themessagesfrom the report individually so that not only the ANSI code are not displayed as escaped, but they actually colorize the output as they should.Also, whenever
::RSpec::Core::ConfigurationOptions.new(cli_args)aborts, Knapsack Pro catches it so that error handling is consistent regardless of where the failure happens (there or the line after).I managed to remove the wall of text of the error in two ways:
raisemeans we don't print a stacktraceExamples
Before
After
Before
After
Before
After
Checklist reminder
UNRELEASEDsection of theCHANGELOG.md, including the needed bump (ie, patch, minor, major)lib/knapsack_pro/pure/queue/rspec_pure.rbcontains pure functions that are unit tested.lib/knapsack_pro/extensions/rspec_extension.rbencapsulates calls to RSpec internals and is integration and e2e tested.lib/knapsack_pro/runners/queue/rspec_runner.rbinvokes the pure code and the extension to produce side effects, which are integration and e2e tested.