New differ
Hello
Few people express the lack of clear informations with the RSpec diff output. As expressed [1][2]. @myronmarston explained the issue with diff-lcs and why we should use a new matcher for RSpec dedicated to RSpec semantics.
A differ written for RSpec, that understands the semantics of RSpec matching, would produce far better output. - source
List of issues with current differ
- https://github.com/rspec/rspec-core/issues/2535#issue-312110983 and https://github.com/rspec/rspec-core/issues/2535#issuecomment-393224649
- https://github.com/rspec/rspec-expectations/issues/1067
- https://github.com/rspec/rspec-expectations/issues/1064
- https://github.com/rspec/rspec-expectations/issues/97
- https://github.com/rspec/rspec-expectations/issues/496
- https://github.com/rspec/rspec-support/issues/211
- https://github.com/rspec/rspec-expectations/issues/1120
- https://github.com/rspec/rspec-expectations/issues/1321
- related discussion https://github.com/rspec/rspec-support/pull/516
Gems that try to improve the differ
- https://github.com/mcmire/super_diff
- https://github.com/playup/diff_matcher and https://github.com/playup/diff_matcher#use-with-rspec
Attempt tried
- https://github.com/rspec/rspec-core/issues/2535#issuecomment-390347789
- https://github.com/rspec/rspec-expectations/issues/54#issuecomment-14357283
- https://gist.github.com/alexch/474363
I planned long time ago to port the differ that is included with Elixir's ExUnit but didn't do it because of lack of time.
I am wondering what we are trying to do, what are the expectations. I have listed few issues with the current differ below. I think super-diff by @mcmire is a good start but the dependency should be dedicated to RSpec and deal with more types of objects.
I would love to work and get help on this subject for RSpec 4 but I need to know the expectations.
For example get rid of diff-lcs and create a new RSpec gem that will include diff mechanism plus a new ObjectFormater but only to output diff of expected VS actual?
At the moment it is difficult to change ObjectFormater.
The
ObjectFormatteris currently used in several ways, to format objects for descriptions etc, and to format them for expected / actual [source]
My last attempt to improve only string diff was a failure because ObjectFormater is used in various place and I had many failing tests in different RSpec gems.
Maybe we should first create a new class that will include diff mechanism (start with diff-lcs) plus a new ObjectFormater for actual/expected diff? For the end user it will mean no changes but for us it will be easier to start to work on a better diff output for RSpec 4?
"for each desired change, make the change easy (warning: this may be hard), then make the easy change"