In the beforeTest/afterTest hooks, the first parameter passed (named test in the docs) is an object that looks a lot like the this.currentTest object that you normally have access to, but it is missing some parts that are useful.
But it would be nice to just have access to the actual mocha test here.
My specific use case is that I want to report an error to mocha. (I'm using a tool called Applitools Eyes that does screenshot testing) My existing afterEach() looks like:
afterEach(function() => {
try {
// This can fail
eyes.close();
} catch(ex) {
// report the error for this test, but do not bail on the whole suite
this.test.error(ex)
}
};
but this is impossible with the wdio afterTest hook, because there is no equivalent of this.test.error
In the
beforeTest
/afterTest
hooks, the first parameter passed (namedtest
in the docs) is an object that looks a lot like thethis.currentTest
object that you normally have access to, but it is missing some parts that are useful.For instance in mocha you can write
But in the
wdio-mocha-framework
hookafterTest
, it looks likeBut it would be nice to just have access to the actual mocha test here.
My specific use case is that I want to report an error to mocha. (I'm using a tool called Applitools Eyes that does screenshot testing) My existing
afterEach()
looks like:but this is impossible with the
wdio
afterTest hook, because there is no equivalent ofthis.test.error