cucumber / cucumber/common

Support attachments in BeforeAll/AfterAll hooks

Open
#2,276 8 comments 3 reactions 1 assignee Claimed by @davidjgoss View on GitHub
:zap: enhancement
Dominant language
No language data
Stars
3.4k
Forks
679
PR merge metrics
No merged PRs in 30d

Description

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: https://github.com/cucumber/cucumber-js/issues/1109#issuecomment-400542113
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');
});```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.