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

Extract deepEqual implementation with tests to share it with other libraries? #865

Closed
jzaefferer opened this issue Sep 29, 2015 · 16 comments
Labels
Component: Assert Status: Declined Status: Ready A "Meta" type issue that has reached consensus.

Comments

@jzaefferer
Copy link
Member

At least node has its own implementation of deepEqual, as part of the assert module. I have no idea how close their implementation is to ours, might be worth investigating.

@jzaefferer
Copy link
Member Author

Looking around a bit, I found three distinct implementations, all with their own tests. There's definitely potential to share at least tests, better yet implementation.

Not sure how to go about this, and don't yet know the history behind any of these.

@jzaefferer
Copy link
Member Author

For anyone interested in this: Should try to port QUnit's tests to one or all of the other modules and see what fails. We can use those failures to start a discussion with the module owner, along with talking about browser support and whatever else.

@jzaefferer
Copy link
Member Author

After talking to @jdalton about this: We should try to replace our deepEqual implementation with the one in lodash. We can run our existing tests to see if there are (significant) differences in the design. If it works out well, we could promote the lodash implementation to those other projects listed above.

@jzaefferer
Copy link
Member Author

@jdalton I've read https://lodash.com/custom-builds and some other resources, but don't see an option for a (custom) compat build with just isEqual (with dependencies, global or umd exports). What am I missing?

@jdalton
Copy link

jdalton commented Oct 17, 2015

via lodash-cli:

lodash include=isEqual

of via browserify after you npm i lodash.isequal:

browserify -r lodash.isequal -s isEqual -o lodash.isequal.js

@jzaefferer
Copy link
Member Author

I just tried to replace the QUnit.equiv call in assert.js to use _.isEqual instead, and all tests still pass. That's great!

Still need to figure out how to properly integrate lodash into our build, since this is the first external dependency.

@leobalter leobalter added the Status: Ready A "Meta" type issue that has reached consensus. label Oct 20, 2015
@jdalton
Copy link

jdalton commented Oct 21, 2015

Still need to figure out how to properly integrate lodash into our build, since this is the first external dependency.

You could go the webpack route and include isEqual as either require('lodash/lang/isEqual') or require('lodash.isequal').

I can prep a PR tonight to flesh a possible approach out.

@leobalter
Copy link
Member

That would be great, @jdalton!

It looks like replacing internal deepEqual is the easiest part, but it needs some good strategy using webpack/browserify.

@jzaefferer
Copy link
Member Author

Yeah, switching to internal modules internally is currently the bigger issue. Though if we make that work with webpack, it'll be super easy to add external modules.

@jzaefferer
Copy link
Member Author

@jdalton any idea if you'll be able to work on this?

@jdalton
Copy link

jdalton commented Oct 29, 2015

Yes, I'll try to get something working this weekend. Last weekend I was unblocking rollup (es6 module bundler). This weekend can be QUnit bundling time. The switch may want to be put on hold though until after the 4.0 bump as lodash's 3.10.1 doesn't support map/set comparisons.

@jzaefferer
Copy link
Member Author

Sounds goood. Making progress on bundling will be valuable either way.

@jdalton
Copy link

jdalton commented Feb 9, 2016

I should revisit this now that v4 is out.

@jzaefferer
Copy link
Member Author

That would be great! I think our deepEqual implementation has seen some improvements, but that shouldn't stop us from replacing it.

@leobalter
Copy link
Member

I think our deepEqual implementation has seen some improvements, but that shouldn't stop us from replacing it.

yes, I'm looking forward to it.

@Krinkle
Copy link
Member

Krinkle commented Aug 30, 2020

Closing for now as I don't expect us to do this any time soon. However if there are one or more persons interested in working on this and have a use case lined up for another library that would consume it, I'd be happy to see this re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Assert Status: Declined Status: Ready A "Meta" type issue that has reached consensus.
Development

No branches or pull requests

4 participants