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

Plug the usual mocha reporter in debug mode? #20

Closed
alexstrat opened this issue Nov 30, 2013 · 5 comments
Closed

Plug the usual mocha reporter in debug mode? #20

alexstrat opened this issue Nov 30, 2013 · 5 comments

Comments

@alexstrat
Copy link

In debug mode, karma proposes a very-simple in-browser reporter that prints the result in browser console.

Would that be possible to plug the usual Mocha HTML reporter?

3fg-

@vojtajina
Copy link
Contributor

Yep, this is possible. You can detect the "debug" by checking window.location and then register the HTML reporter.

That said, the reporter will live in the same document as the actual tests and so if you tests use the DOM, it might conflict with each other; for instance your test might add some div into the body and then expect there is one div (ok, this is stupid, but you know what I mean;-)), then the reporter produces additional divs and so the debug will behave differently than the regular run. Also your tests can destroy the HTML reporter output.

So I'm not sure if this is desired/worthy.

If it is, it might be better to write an HTML reporter on using Karma's API (rather than Mocha) and then use it independently of Mocha (you could use it even with Jasmine/QUnit, etc..)

What do other people think?

@alexstrat
Copy link
Author

@vojtajina yes I got your point. And it would be indeed better if Karma could propose a generic solution for that.

@fredericgrati
Copy link

It would be great to have this feature 👍

@chadwithuhc
Copy link

I agree this should be included. The whole reason I chose Mocha was for the HTML reporter. In the mean time I am using @maksimr 's plugin karma-mocha-debug, but this should be a default for the karma-mocha plugin.

@maksimr
Copy link
Contributor

maksimr commented Apr 11, 2014

I think when we fix this issue.

We will can define reporter for debug.html in karma.conf.js like:

...
client: {
  mocha: {
    reporter: '<reporter>'
  }
}
...

maksimr added a commit that referenced this issue Jun 15, 2014
feat: Allow define html reporter on debug page. resolve #20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants