webdriverio-boneyard / wdio-dot-reporter

A WebdriverIO v4 plugin. Report results in dot format.
http://webdriver.io
MIT License
5 stars 4 forks source link

Feature request: Print out all nested describe() hooks for a failing it() hook #96

Open jmalvinez opened 6 years ago

jmalvinez commented 6 years ago

Just found that for wdio-dot-reporter using mocha, when a test with nested describe hooks like the one below fails:

describe('Button -', function () {   describe('When clicked -', function () {     it('Should turn red', function () {       ...     });   }); });

The error printed out only includes the immediate parent of the it hook like this: 1) When clicked - Should turn red

I was able to make a small change to reporter.js so that it would print out all the nested describe hooks like this: 1) Button - When clicked - Should turn red

Does anyone want this new behaviour? If yes, i can create a PR for it... Otherwise, there must be a good a reason why it was made to behave like that, right?

I asked in Gitter about this: https://gitter.im/webdriverio/webdriverio?at=5af514fa862c5e33e9270e6c too.

christian-bromann commented 6 years ago

Feel free to provide a PR

jmalvinez commented 6 years ago

@christian-bromann I need to override the listFailures method in the BaseReporter class but I'm not sure how to do it. If I just assign this.baseReporter.listFailures to a new function lib/reporter.js, I'm afraid that it will also change the same function in the BaseReporter class and affect other kinds of reporters, right? Any ideas on how I can do this correctly?

Basically, I'm going to make this line https://github.com/webdriverio/webdriverio/blob/master/lib/utils/BaseReporter.js#L220 print the all the nested parents instead of just test.parent.