-
Notifications
You must be signed in to change notification settings - Fork 45
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
Highlight complex object diff #32
Comments
I guess this is a duplicate of #26 ? I am short on time right now but i will try to have a look if this can be done with the reporter. |
I spent a bit of time this morning tracing down where this information is coming from. It appears that the issue is in https://github.com/jasmine/jasmine/blob/master/lib/jasmine-core/jasmine.js#L1468 I'm not at all familiar with how jasmine-core operates but it appears that |
Thanks for looking into this. I will use this as starting point. |
I've looked a bit into getting nice diffs in Karma, and it seems like the reporter is really at the mercy of the test framework/assertion library to provide the necessary data to provide the diff. That said, karma-mocha recently added support for passing assertion errors through to the reporter (karma-runner/karma-mocha#85). As far as I can tell, Chai is the only assertion library that would provide enough information on the errors to show a diff of expected/actual. Would it make sense to add support to this reporter for only one possible setup (i.e., karma-mocha + chai)? |
Hey @rosston , thanks for the informations. I will have a look. To get started quickly it would be nice if you could send be a |
Certainly, I can put up an example spec. Would it be helpful to have a full example repo with mocha node tests too? Mocha on node seems to be the gold standard for expected/actual diffs. |
I guess an example spec is enough. Or is the logic the same in mocha for node.js and browser tests? |
Mocha only shows diffs when run in node. In the browser, it uses a different (HTML) reporter, which doesn't support diffs. See mochajs/mocha#1348 (comment) |
@4kochi Here's an example repo: https://github.com/rosston/mocha-diff-example. |
Thanks for your help @ALL. Released as v1.2.0 |
😂 Yes! This has made my week. Thank you, @4kochi. |
It would be great if the reporter would highlight the diff in a complex object instead of just dumping both the expected and actual to the console. I'm using karma-jasmine because karma-mocha doesn't show the stacktrace on error and using chai 'assert' assertions.
Using:
The text was updated successfully, but these errors were encountered: