Skip to content

Support attachments in BeforeAll/AfterAll hooks #2276

@flywojt

Description

@flywojt

I want to add a log file as an attachment to report after tests execution. I wanted to use AfterAll hook but according to this comment: cucumber/cucumber-js#1109 (comment)
this is impossible. How can I achieve that? Is this possible to import attach method directly to AfterAll hook?

// This is not working as AfterAll hook dosn't have acces to World instance 
AfterAll(async function () { 
      const file = await fs.readFileSync('./features/support/scp_util/file.txt') 
      this.attach(file, 'text/plain'); 
  });```

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions