Add object diff#589
Conversation
|
well for example if you're doing |
|
You are right, for stylus unit tests, char diff is probably too fine-grained. Then maybe we can introduce a mocha option for that? Values like jsDump is basically a more tolerant version of QUnit also uses it to display diffs. |
|
You would also want to accept Automattic/expect.js#34 if you accept this request. That pull request makes expect.js also display diffs. |
|
the problem with doing diffs this way is that we're obscuring the real error message, and just showing a diff, also not sure about jsDump, might have to think on that a bit im not sold |
|
what do you mean by "real error message"? when two objects are different, isn't showing their diff the real error message? |
|
well for example if you had |
|
assert libs shouldn't assign speaking of which, I guess my commit for expect.js should leave |
|
well those props aren't even specifically for mocha, they just hold the expected/actual values so you can choose to do other things with them. going mocha-specific wouldn't really be too great. Ideally I guess we have alternative messages or something, bit of a tough thing abstraction-wise I guess |
|
then how about adding another prop to the error object like |
|
yeah that might be a reasonable alternative, sounds good to me for now at least! |
|
cool. will send a new commit asap. |
|
done, including the expect.js pulll request. |
|
do you think a mocha option for diff methods still stands? not sure how to access mocha options in the base reporter. if you could shed some light, I'd like to take a stab at it. |
|
I'll add a prop like that to should.js as well and see how it goes |
|
this pr's pretty out of date. feel free to reopen if you want this and have made your changes up to date |
I changed when to display invisible chars so object diffs won't be too crazy.
I'm also wondering should character diff always be used? Since we are testing js values, and whitespaces are almost always significant in this case, but I'm not sure, what do you think?