michaelleeallen / mocha-junit-reporter

A JUnit XML reporter for mocha.
MIT License
144 stars 153 forks source link

Unable to set an attachments in AfterEach hook #84

Closed ghost closed 5 years ago

ghost commented 5 years ago

I'm trying to set an attachments with absolute path to a screenshot in case test failed in AfterEach hook.

this.test.attachments = [absolutePath] works great from test. But when I moved that line to AfterEach hook it stop working. I've tried to use those and attachment wasn't added: this.test.attachments = [absolutePath]; this.currentTest.attachments = [absolutePath]; this.currentTest.ctx.attachments = [absolutePath]; this.test.ctx.attachments = [absolutePath];

Is there any way to attach a screenshot path from AfterEach hook?

Redinbox commented 2 years ago

this.test.ctx.attachments = [absolutePath]

Please let me know any solution for this>