michaelleeallen / mocha-junit-reporter

A JUnit XML reporter for mocha.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Attachement in afterEach hook in mocha

12masta opened this issue · comments

Hey,

I am unable to add attachment in afterEach hook. It is working only in the test itself.

I am using proper cmd args like:

--reporter-options attachments=true

Not working:
afterEach(async function afterEach() { this.test.attachments = [file.mp4]; }

Working:
it('test', async function() { this.test.attachments = [file.mp4]; });

Unfortunately with that approach function is useless - because in my cases I want only recordings of failed tests only. Beside that I don't want to put that line for every test.

I saw that topic but it is unresolved: #85

It is resolved in Cypress and in Codecept so im sure that there Is a way to resolve it! But after digging arround have no idea.

@12masta - did you ever figure this out? I'm having the same issue attempting to add a cypress screenshot to the generated junit report and not having any luck.

@12masta - did you ever figure this out? I'm having the same issue attempting to add a cypress screenshot to the generated junit report and not having any luck.

Unfortunately not. Maybe it is changed since I faced this and there is some way to accomplish it.