-
Notifications
You must be signed in to change notification settings - Fork 5
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
mochawesome custom reporter support #2
Comments
Thank you for the bug report. You are right, and it seems like I only had this partially working. Sorry about that! I will remove the mention of "mochawesome" from README.md for now, and then investigate the issue further. How urgent is this issue for you? |
Hi, thank you for the quick response! It's not too urgent, I will go with the xml reporter option for the time being. I am curious though, would allowing a mocharc.json file to be forwarded to the mocha instance be too complicated? Perhaps this would remove the need to explicitly support reporters and other configs? |
Thx. Could you create a separate issue for using mocharc.json over explicit CLI options, as that appears to be a separate improvement in its own right? I have marked this issue with "enhancement" and will keep it open. |
I think I understand the relationship between all of the pieces in the project a bit better, but please let me know if I don't... But I think it might be possible for us to "intercept" when "mochawesome" is specified as a reporter and then handle it by replacing "mochawesome" with "json". When the tests complete and the output comes back, it'll be in string/JSON form, if we can intercept this output and do a JSON.parse(), we should be able to just do mochawesome.create(outputObj) to have mochawesome-report-generator create the output. I can start creating a prototype PR and testing, but I would need some direction for when/how the results are logged. I tried exploring a bit, but I can't seem to find it.... |
Good suggestion, but unfortunately I don't think that will work. I assume that "outputObj" here is Mocha's output object, which contains a lot of self references (e.g. tests reference suites, and suites reference tests). And the "json" reporter only serializes a tiny bit of this object, which is the reason why this project includes the mochaProtocolReporter so we can include more of Mocha's objects and "recreate" some of the self references in mochaProtocolPlayer. I believe the right strategy is to figure out which further properties of Mocha's output object is needed by mochawesome, and then add those to the mochaProtocolReporter and -Player. |
Using the mochawesome reporter, if I breakpoint after the tests run, the mochaProtocolPlayer.reporter.output seems to be almost in a good shape to be useful. There are a few issues though, within that object, each suite object needs a "_timeout" key/value and it seems that all of the specs are reporting as skipped. Not really sure why.... |
I don't know either - more debugging required, I guess - happy to assist with ideas, if you share a fork with a specific question! |
I'm trying to setup mochawesome to report the results, but I cannot get any output to be generated.
I've tried the default script:
mocha-vite-puppeteer --reporter mochawesome
As well as specifying a json file which looks like this:
{ "html": true }
The tests run and pass, but no output files are generated.
I've tested all of the other built-in reporters (dot, json, etc.) which all work and the other custom reporter, mocha-junit-reporter, is outputting a file correctly.
I tried debugging and following the reporter lookup functions you've made, but things went a bit over my head...
edit: using mochawesome version 6.2.2
The text was updated successfully, but these errors were encountered: