-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
hooks.ts
44 lines (37 loc) · 833 Bytes
/
hooks.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { When, Before, After, World } from '../../../src'
import fs from 'fs'
import path from 'path'
Before(function () {
// no-op
})
Before({ name: 'A named hook' }, function () {
// no-op
})
When('a step passes', function () {
// no-op
})
When('a step throws an exception', function () {
throw new Error('Exception in step')
})
After(function () {
throw new Error('Exception in hook')
})
After('@some-tag or @some-other-tag', function () {
throw new Error('Exception in conditional hook')
})
After('@with-attachment', async function (this: World) {
await this.attach(
fs.createReadStream(
path.join(
process.cwd(),
'node_modules',
'@cucumber',
'compatibility-kit',
'features',
'hooks',
'cucumber.svg'
)
),
'image/svg+xml'
)
})