Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Add additional info to test results for better output #85

Merged

Conversation

roadhump
Copy link
Contributor

Hello, I've just created karma-mocha-own-reporter, plugin which allows to use Mocha reporters in Karma. But it seems there is no easy way to make pretty diff output for my plugin like in Mocha itself. Any reporter gets not enough information for such output, just a string of assertion error message.

So I suggest to extend data which your plugin passes to reporters with assertionErrors, array of objects similar to errors Mocha assertion libraries produce. It contains info about expected and actual test outcome. This information will help me (or any other developer) to create more rich reporters.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@roadhump
Copy link
Contributor Author

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@dignifiedquire
Copy link
Member

Could you add some documentation about this, so that it's easier to find for others later what properties are provided.

@roadhump
Copy link
Contributor Author

@dignifiedquire What is the best place for documentation here?

@dignifiedquire
Copy link
Member

@roadhump just add a section to the readme titled Internals or something like that

@dignifiedquire
Copy link
Member

Merging this for now, if you find some time please make another pr with some docs

dignifiedquire added a commit that referenced this pull request Jan 2, 2016
Add additional info to test results for better output
@dignifiedquire dignifiedquire merged commit 5bdece6 into karma-runner:master Jan 2, 2016
@roadhump
Copy link
Contributor Author

roadhump commented Jan 7, 2016

Here is updated README #87

@panrafal
Copy link

Any chances of releasing this as a new version @dignifiedquire ? @roadhump does your reporter work with diffs already?

@dignifiedquire
Copy link
Member

Release is out

Comment on lines +30 to +31
error.actual = window.Mocha.utils.stringify(error_.actual)
error.expected = window.Mocha.utils.stringify(error_.expected)
Copy link

@oliviertassinari oliviertassinari Nov 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This crash when actual or expected has a circular reference: mochajs/mocha#4910. For example, this happens when actual is a DOM element rendered by React.

@roadhump what was the use case for this logic? It seems something that you could do on the side of your custom reporter. https://github.com/roadhump/karma-mocha-own-reporter/blob/933b12d5567ba27b94c3b1c9c61e49f6146c6863/index.js#L82

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants