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

Fix missing mocha test hooks in a junit report #5812

Conversation

vgrigoruk
Copy link
Contributor

@vgrigoruk vgrigoruk commented Sep 9, 2020

Proposed changes

After upgrading to wdio 6 (and mocha 8), we have noticed that junit report doesn't contain failed mocha hooks anymore.

It looks like mocha test hook titles are changed in mocha 8. Previously, it is used to be "before all" hook", "after all" hook, etc, but now it is "before all" hook for "test name".
This PR fixes the condition used to add failed hooks to a generated junit report. It also adds beforeEach/afterEach hooks to the junit report.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Further comments

Reviewers: @webdriverio/project-committers

@mgrybyk
Copy link
Member

mgrybyk commented Sep 9, 2020

Can you please add a test for that?

@christian-bromann
Copy link
Member

@vgrigoruk please let us know if we can help you with the unit tests 😉

@vgrigoruk
Copy link
Contributor Author

We already have a test forbefore all and after all hooks (however, the fixture data have titles in a pre-mocha-8 format and that's why it didn't fail previously). I've kept this test as is to prove the change is backward-compatible.
I've also added tests for failed before each and after each hooks, which test against mocha 8 format of hook title field.

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Bug Fix 🐛 PRs that contain bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants