Skip to content

Commit 9e5fd7d

Browse files
Update dependency @cucumber/compatibility-kit to v18 (#33)
* Update dependency @cucumber/compatibility-kit to v18 * refactor cck on our side * bump cck dep for bug fix --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: David Goss <[email protected]>
1 parent 3363ab2 commit 9e5fd7d

File tree

10 files changed

+67
-24
lines changed

10 files changed

+67
-24
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"type-fest": "^4.33.0"
3737
},
3838
"devDependencies": {
39-
"@cucumber/compatibility-kit": "^17.0.0",
39+
"@cucumber/compatibility-kit": "^18.0.1",
4040
"@eslint/compat": "^1.2.5",
4141
"@eslint/eslintrc": "^3.2.0",
4242
"@eslint/js": "^9.18.0",
1.41 KB
Loading
1.7 KB
Loading
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { When } from '@cucumber/node'
2+
import fs from 'node:fs'
3+
4+
When('a JPEG image is attached', async (t) => {
5+
await t.attach(fs.createReadStream(import.meta.dirname + '/cucumber.jpeg'), {
6+
mediaType: 'image/jpeg',
7+
})
8+
})
9+
10+
When('a PNG image is attached', async (t) => {
11+
await t.attach(fs.createReadStream(import.meta.dirname + '/cucumber.png'), {
12+
mediaType: 'image/png',
13+
})
14+
})
File renamed without changes.

test/cck/hooks-attachment/support.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import fs from 'node:fs'
2+
import {Before,After,When} from '@cucumber/node'
3+
4+
Before(async (t) => {
5+
await t.attach(fs.createReadStream(import.meta.dirname + '/cucumber.svg'), {mediaType: 'image/svg+xml'})
6+
})
7+
8+
When('a step passes', () => {
9+
// no-op
10+
})
11+
12+
After(async (t) => {
13+
await t.attach(fs.createReadStream(import.meta.dirname + '/cucumber.svg'), {mediaType: 'image/svg+xml'})
14+
})
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import {Before,After,When} from '@cucumber/node'
2+
3+
Before({tagFilter: '@passing-hook'}, async () => {
4+
// no-op
5+
})
6+
7+
Before({tagFilter: '@fail-before'}, () => {
8+
throw new Error('Exception in conditional hook')
9+
})
10+
11+
When('a step passes', () => {
12+
// no-op
13+
})
14+
15+
After({tagFilter: '@fail-after'}, () => {
16+
throw new Error('Exception in conditional hook')
17+
})
18+
19+
After({tagFilter: '@passing-hook'}, async () => {
20+
// no-op
21+
})

test/cck/hooks-named/support.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import {Before,After,When} from '@cucumber/node'
2+
3+
Before({ name: 'A named before hook' }, () => {
4+
// no-op
5+
})
6+
7+
When('a step passes', () => {
8+
// no-op
9+
})
10+
11+
After({ name: 'A named after hook' }, () => {
12+
// no-op
13+
})

test/cck/hooks/support.mjs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
import fs from 'node:fs'
2-
import path from 'node:path'
31
import {Before,After,When} from '@cucumber/node'
42

53
Before(() => {
64
// no-op
75
})
86

9-
Before({name: 'A named hook'}, () => {
10-
// no-op
11-
})
12-
137
When('a step passes', () => {
148
// no-op
159
})
@@ -20,17 +14,4 @@ When('a step fails', () => {
2014

2115
After(() => {
2216
// no-op
23-
})
24-
25-
After({
26-
tagFilter: '@some-tag or @some-other-tag'
27-
}, () => {
28-
throw new Error('Exception in conditional hook')
29-
})
30-
31-
After({tagFilter: '@with-attachment'}, async (t) => {
32-
await t.attach(fs.createReadStream(path.join(
33-
import.meta.dirname,
34-
'cucumber.svg',
35-
)), {mediaType: 'image/svg+xml'})
3617
})

0 commit comments

Comments
 (0)