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

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

Open
jmalvinez opened this issue May 11, 2018 · 2 comments

Comments

@jmalvinez
Copy link

jmalvinez commented May 11, 2018

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
Copy link
Contributor

Feel free to provide a PR

@jmalvinez
Copy link
Author

@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.

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

2 participants