Skip to content
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

mocha.js browser version: support for third party reporters #1592

Closed
ghost opened this issue Mar 12, 2015 · 6 comments
Closed

mocha.js browser version: support for third party reporters #1592

ghost opened this issue Mar 12, 2015 · 6 comments

Comments

@ghost
Copy link

ghost commented Mar 12, 2015

I am having trouble requiring new reporters using the browser based version of mocha.js. the require object and associated methods seem to be locked away behind the IEFE that surrounds mocha. If this is wrong, feel free to enlighten me.

Also, the process.stdout.write() stub is missing in the browser version of mocha. This makes reporters like JSONreporter, which is included inside the IIFE fail with no output.

Thanks

@ghost
Copy link
Author

ghost commented Mar 16, 2015

Bump......?

@danielstjules
Copy link
Contributor

Will take a look this evening! Sorry for the late reply

@ghost
Copy link
Author

ghost commented Mar 17, 2015

Awesome, thanks.

On Monday, March 16, 2015, Daniel St. Jules notifications@github.com
wrote:

Will take a look this evening! Sorry for the late reply


Reply to this email directly or view it on GitHub
#1592 (comment).

@danielstjules
Copy link
Contributor

Hi @errold32, you're right - it doesn't look like there's any support for Third Party reporters in the browser. Sorry about that. I'm not sure if anyone's planned on taking this on yet.

If this is a more immediate request/need, you could consider using https://github.com/metaskills/mocha-phantomjs for their third party reporter support, or maintaining your own temporary fork of the project.

If it were supported, considering the work involved in building an HTML reporter - it wouldn't be as simple as writing a custom node reporter. Comparing the dot and html reporters should give you an idea.

@ghost
Copy link
Author

ghost commented Mar 18, 2015

Thanks for the reply. I’ve temporarily solved the problem by making the require function a method of the window object in a similar fashion to the mocha object. This allows me to place the reporter in a separate file, and edit it to my heart’s content. I’ve basically duplicated the html reporter and extended it. Forgive me if I am wrong, but it seems like a few of the reporters included in the mocha.js for browser aren’t really useful in a browser environment because they print to the console. Speaking of printing to the console, the process.stdout.write() stub is also missing, making the JSON reporter for instance do nothing. (or error out in IE). I don’t mean to be critical, but I just wonder about the inclusion of some of those reporters in the browser version of mocha.

I think I need the html reporter, but will take a look at phantomjs.

Thanks.

David

From: Daniel St. Jules [mailto:notifications@github.com]
Sent: Monday, March 16, 2015 11:25 PM
To: mochajs/mocha
Cc: errold32
Subject: Re: [mocha] mocha.js browser version: support for third party reporters (#1592)

Hi @errold32 https://github.com/errold32 , you're right - it doesn't look like there's any support for Third Party reporters in the browser. Sorry about that. I'm not sure if anyone's planned on taking this on yet.

If this is a more immediate request/need, you could consider using https://github.com/metaskills/mocha-phantomjs for their third party reporter support, or maintaining your own temporary fork of the project.

If it were supported, considering the work involved in building an HTML reporter - it wouldn't be as simple as writing a custom node reporter. Comparing the dot and html reporters should give you an idea.


Reply to this email directly or view it on GitHub #1592 (comment) . https://github.com/notifications/beacon/AK5u5ov-Fp4kOdeKvklPRnzn6z4_0RnQks5n18AngaJpZM4DtXDR.gif

@boneskull
Copy link
Contributor

closing in lieu of #1457

Lindsay-Needs-Sleep added a commit to Lindsay-Needs-Sleep/mocha that referenced this issue Sep 23, 2019
…n browser

Issue mochajs#1592 (So that people who find this issue before the official docs can see this....)
Lindsay-Needs-Sleep added a commit to Lindsay-Needs-Sleep/mocha that referenced this issue Sep 24, 2019
…ser.

Issue mochajs#1592 (You can specify a the constructor of your custom reporter in options and mocha will use it)
Lindsay-Needs-Sleep added a commit to Lindsay-Needs-Sleep/mocha that referenced this issue Sep 24, 2019
…ser.

Issue mochajs#1592 (You can specify a the constructor of your custom reporter in options and mocha will use it)
Lindsay-Needs-Sleep added a commit to Lindsay-Needs-Sleep/mocha that referenced this issue Sep 24, 2019
…ser.

Add the JSON Stream name that is recommended in the documentation as an alias for the json-stream recommender.
Issue mochajs#1592 (You can specify a the constructor of your custom reporter in options and mocha will use it)
Lindsay-Needs-Sleep added a commit to Lindsay-Needs-Sleep/mocha that referenced this issue Sep 24, 2019
…ser.

Add the JSON Stream name that is recommended in the documentation as an alias for the json-stream recommender.
Make references to a reporter's name more uniform.
Issue mochajs#1592 (You can specify a the constructor of your custom reporter in options and mocha will use it)
Lindsay-Needs-Sleep added a commit to Lindsay-Needs-Sleep/mocha that referenced this issue Sep 24, 2019
…ser.

Make references to a reporters' names more uniform.
Issue mochajs#1592 (You can specify a the constructor of your custom reporter in options and mocha will use it)
Lindsay-Needs-Sleep added a commit to Lindsay-Needs-Sleep/mocha that referenced this issue Oct 4, 2019
You can specify a the constructor of your custom reporter in options and mocha will use it.
Make references to a reporters' names more uniform.
Lindsay-Needs-Sleep added a commit to Lindsay-Needs-Sleep/mocha that referenced this issue Oct 8, 2019
You can pass the constructor function of your custom reporter in options and mocha will use it.
Lindsay-Needs-Sleep added a commit to Lindsay-Needs-Sleep/mocha that referenced this issue Oct 13, 2019
You can pass the constructor function of your custom reporter in options and mocha will use it.
Lindsay-Needs-Sleep added a commit to Lindsay-Needs-Sleep/mocha that referenced this issue Oct 13, 2019
You can pass the constructor function of your custom reporter in options and mocha will use it.
Lindsay-Needs-Sleep added a commit to Lindsay-Needs-Sleep/mocha that referenced this issue Oct 13, 2019
You can pass the constructor function of your custom reporter in options and mocha will use it.
Lindsay-Needs-Sleep added a commit to Lindsay-Needs-Sleep/mocha that referenced this issue Oct 13, 2019
You can pass the constructor function of your custom reporter in options and mocha will use it.
Lindsay-Needs-Sleep added a commit to Lindsay-Needs-Sleep/mocha that referenced this issue Oct 13, 2019
You can pass the constructor function of your custom reporter in options and mocha will use it.
juergba pushed a commit to Lindsay-Needs-Sleep/mocha that referenced this issue Oct 14, 2019
You can pass the constructor function of your custom reporter in options and mocha will use it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants