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

Support deep matchers #203

Merged
merged 10 commits into from Mar 12, 2017
Merged

Support deep matchers #203

merged 10 commits into from Mar 12, 2017

Conversation

searls
Copy link
Member

@searls searls commented Mar 11, 2017

Resolves #142, #109, #160

  • fix unit tests in Support deep matchers #142
  • patch stringify-object to be able to pretty-print deep matchers
  • fix circular structure bug (e4ea059)
  • fix entire build
  • refactor original PR
  • release stringify-object (or a fork)

Finally looked at implementation and saw that it'd recurse 
infinitely for objects with circular structures, which is 
definitely not good (and will break td.js even when not
using matchers
Trying to implement a recursive element comparator entirely
inside this function would have been really confusing/error
prone (esp. considering how much work has gone into making
lodash's do the right thing). This commit uses the
`_.isEqualWith` function's `customizer` predicate to be able to
selectively compare values that match a condition (or return
undefined to fall back to default behavior.

In our case, if the expected element is a matcher (which we can
determine based on the presence of `__matches`), then we will
try to match it to the actual element. 

This fixes e4ea059
@searls
Copy link
Member Author

searls commented Mar 12, 2017

Figured out the reason for the breaking build is that when stringify-object dropped Node < 4 support, our browserify build will now contain a bunch of unsupported-in-some-browsers-like-phantomjs keywords like const.

I'm unsure how to tell babelify to transform a specific module dep, researching now. (cc/ @davemo @jasonkarns )

Reference:
yeoman/stringify-object@76a5122

(But alas, tethering on 2G data does not agree with `npm`)
@searls searls merged commit e38193e into master Mar 12, 2017
@searls searls deleted the uhoh-itsmaciek-deep-matchers branch March 12, 2017 18:36
This was referenced Mar 12, 2017
@msakrejda
Copy link

omg thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants