You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If there is an exception in Mocha's after suite hook, there will be an UnhandledPromiseRejectionWarning in reporter.js which will cause the test to hang.
To reproduce, set up a test that has an exception in the Mocha after hook.
Environment
WebdriverIO version: 5.18.7
wdio-reportportal-version version: 6.1.0
Node.js version: 14.15.4
wdio/mocha-framework: 5.18.7
Additional wdio packages used (if applicable):
Additional context:
The actual error thrown is:
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null
at ReportPortalReporter.onTestStart (C:\automation\workspace\dozi-apps-web-engage-ui\node_modules\wdio-reportportal-reporter\build\reporter.js:137:37)
at ReportPortalReporter.onHookEnd (C:\automation\workspace\dozi-apps-web-engage-ui\node_modules\wdio-reportportal-reporter\build\reporter.js:265:22)
This is what I believe is happening after some investigation...
In this case, in the onHookEnd in the reporter.js, there is an error and testItem in null so it is calling the onTestStart method. In the onTestStart method, it tries to get the current suite but since we are in the after suite hook, the suite no longer exists so it is null. When the following line is called:
const { tempId, promise } = this.client.startTestItem(testStartObj, this.tempLaunchId, suite.id);
suite is null so it is not able to get suite.id which is throwing the Cannot read property 'id' of null
The text was updated successfully, but these errors were encountered:
@dorg-jskinner thanks for reporting this. I reproduced the error.
Btw it will be not easy to fix. Current reporter logic aren't ready to report hooks and especially such mocha after suite hooks. I would suggest add more describes and make this hook bounded to some describe e.g.
before
If there is an exception in Mocha's after suite hook, there will be an UnhandledPromiseRejectionWarning in reporter.js which will cause the test to hang.
To reproduce, set up a test that has an exception in the Mocha after hook.
Environment
Additional context:
The actual error thrown is:
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null
at ReportPortalReporter.onTestStart (C:\automation\workspace\dozi-apps-web-engage-ui\node_modules\wdio-reportportal-reporter\build\reporter.js:137:37)
at ReportPortalReporter.onHookEnd (C:\automation\workspace\dozi-apps-web-engage-ui\node_modules\wdio-reportportal-reporter\build\reporter.js:265:22)
This is what I believe is happening after some investigation...
In this case, in the onHookEnd in the reporter.js, there is an error and testItem in null so it is calling the onTestStart method. In the onTestStart method, it tries to get the current suite but since we are in the after suite hook, the suite no longer exists so it is null. When the following line is called:
const { tempId, promise } = this.client.startTestItem(testStartObj, this.tempLaunchId, suite.id);
suite is null so it is not able to get suite.id which is throwing the Cannot read property 'id' of null
The text was updated successfully, but these errors were encountered: