Closed snoblenet closed 6 years ago
@snoblenet feel free to propose a PR for this.
done! thx :-)
Closing this then
Hi @christian-bromann, was this PR suited to be merged? I ask because I know @fijijavis was waiting for this update before he updated wdio-mochawesome-reporter
, and I'm hoping to submit a PR in this sprint at my work that relies on his upcoming changes.
@snoblenet just released your patch as v0.5.12
@snoblenet Were you able to successfully validate this change? I've bumped to v0.5.12 and setup a test as follows, but do not see context added to the message:
test('Sample Test 1',function(){
this.context="This is a test"
browser.url('/')
})
AFAICT context is not getting added to params.payload
Hi when I tested the patch, I used the addContext method. The added context definitely appeared in the spot I mentioned earlier. (Sorry responding from phone; don’t have details here.)
Hi there, you definitely want to use Mochawesome's addContext
method, for a number of reasons, including the fact that it adds context to this.test
or this.currentTest
(not this
) depending on whether it is called with an it
, before
or after
block. How's it all coming together?
@snoblenet Ok. For some reason I was thinking the implementation would not require me to import anything from mochawesome.
The mighty 'Mochawesome' reporter adds a
context
key to the test object:https://github.com/adamgruber/mochawesome/blob/master/src/addContext.js#L85
However, the
wdio-mochawesome-reporter
is not currently receiving this information:https://github.com/fijijavis/wdio-mochawesome-reporter/issues/3#issuecomment-348031747
I think this might be because
wdio-mocha-framework
is forwarding just the keys it is interested in:https://github.com/webdriverio/wdio-mocha-framework/blob/d96c58512ad14ae34ce9ec7cfae0a73403a9703c/lib/adapter.js#L169
If my guess is correct, would it be possible for
wdio-mocha-framework
to pass on these keys too?Thanks.