Closed lundibundi closed 6 years ago
@tshemsedinov @belochub ping.
Also, @tshemsedinov what do you think of replacing our own
Good idea but we have to support running tests in browser therefore not really applicable (unless we directly copy code from node.js core util.js)compare/strictEqual
with Node core util.isDeepStrictEqual(val1, val2)
as it seems to support all of the checks we support and also takes care of circular references, proper buffer comparison and more (https://github.com/nodejs/node/blob/master/lib/internal/util/comparisons.js)?
Blocking this before https://github.com/metarhia/metatests/pull/66. It's much easier to refactor this one than dealing with conflicts in #66.
Ping @belochub @tshemsedinov this is now ready.
@lundibundi we will need to run metatests
in browser. We should maybe write our own function instead of using Node.js's util.inspect
and polyfill for it. WDYT?
Well, it is reasonable, though it's quite hard to implement such a function so that it will properly be usable for comparison and display of the results. I'd say to add guards for browser (use JSON.stringify there) for now and in a follow-up PR actually implement it and move away from using util.inspect
.
wdyt?
@lundibundi ok.
@lundibundi what's the point of this PR then, as it just replaces one wrong way of checking for equality with another? I think we should start with implementing a new comparison function.
Well, this way of checking the equality at least works properly and properly shows the difference (even though only in node). And for the browser we will implement a new one. Rightn now we want to release a next version and I think it'd be better if it at least worked correctly in node.
@lundibundi According to Node.js documentation:
The
util.inspect()
method returns a string representation of object that is intended for debugging. The output ofutil.inspect
may change at any time and should not be depended upon programmatically.
I think we shouldn't use this method for value comparison; it is not an intended or appropriate use of this method.
We've already released a new version today, we can implement a better way of comparison instead of this one and publish it in the next version, I don't think there's a need to add some kludges to speed up the process of releasing the new version.
Oh well, that's unfortunate, I thought I could make it in time. Ok then.
This will fix https://github.com/metarhia/metatests/issues/63. Also in the current 'declarative' checker, you can do
const f = x => x
and[Number.NaN, null]
it will not fail. This PR fixes that. Though I wanted to add a negative declarative test case but couldn't finds a way to do it, is it possible?I ran
common
tests and found a bug. Also triedglobalstorage
tests but it just hang indefinitely on mongo provider tests, do I need anything special (besides mongodb) to run them?