Skip to content

Commit 8f2ff57

Browse files
authored
chore: update @cucumber/* dependencies, fix willBeRetried usage (#1776)
* latest dependencies * make it just about compile * fix test case runner * fix summary helper * fix formatters (ish) * fix last bit in formatters * update fixtures for feature tests * fix attachments cck * hook up retry cck * lint * update doc * update lockfile
1 parent 4e85157 commit 8f2ff57

21 files changed

+227
-208
lines changed

compatibility/cck_spec.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,20 @@ describe('Cucumber Compatibility Kit', () => {
2626
const suiteName = match[1]
2727
const extension = match[2]
2828
it(`passes the cck suite for '${suiteName}'`, async () => {
29-
const args = [
30-
'node',
31-
path.join(PROJECT_PATH, 'bin', 'cucumber-js'),
32-
].concat([
29+
const cliOptions = [
3330
`${CCK_FEATURES_PATH}/${suiteName}/${suiteName}${extension}`,
3431
'--require',
3532
`${CCK_IMPLEMENTATIONS_PATH}/${suiteName}/${suiteName}.ts`,
3633
'--profile',
3734
'cck',
38-
])
35+
]
36+
if (suiteName === 'retry') {
37+
cliOptions.push('--retry', '2')
38+
}
39+
const args = [
40+
'node',
41+
path.join(PROJECT_PATH, 'bin', 'cucumber-js'),
42+
].concat(cliOptions)
3943
const stdout = new PassThrough()
4044
try {
4145
await new Cli({

compatibility/features/attachments/attachments.ts

+19-2
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,26 @@ When('a JPEG image is attached', async function (this: World) {
6363
'compatibility-kit',
6464
'features',
6565
'attachments',
66-
'cucumber-growing-on-vine.jpg'
66+
'cucumber.png'
6767
)
6868
),
69-
'image/jpg'
69+
'image/png'
70+
)
71+
})
72+
73+
When('the {word} png is attached', async function (filename) {
74+
await this.attach(
75+
fs.createReadStream(
76+
path.join(
77+
process.cwd(),
78+
'node_modules',
79+
'@cucumber',
80+
'compatibility-kit',
81+
'features',
82+
'attachments',
83+
filename
84+
)
85+
),
86+
'image/png'
7087
)
7188
})

compatibility/features/retry/retry.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Given } from '../../../src'
2+
3+
Given('a step that always passes', function () {
4+
// no-op
5+
})
6+
7+
let secondTimePass = 0
8+
Given('a step that passes the second time', function () {
9+
secondTimePass++
10+
if (secondTimePass < 2) {
11+
throw new Error('Exception in step')
12+
}
13+
})
14+
15+
let thirdTimePass = 0
16+
Given('a step that passes the third time', function () {
17+
thirdTimePass++
18+
if (thirdTimePass < 3) {
19+
throw new Error('Exception in step')
20+
}
21+
})
22+
23+
Given('a step that always fails', function () {
24+
throw new Error('Exception in step')
25+
})

docs/migration.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ Now in `@cucumber/cucumber`:
6161
"duration": {
6262
"seconds": "0",
6363
"nanos": 660000000
64-
},
65-
"willBeRetried": true
64+
}
6665
}
6766
}
6867
```

features/fixtures/formatters/failed.message.json.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ module.exports = [
139139
nanos: 0,
140140
},
141141
status: 'FAILED',
142-
willBeRetried: false,
143142
message: 'Error: my error',
144143
},
145144
timestamp: {
@@ -155,6 +154,7 @@ module.exports = [
155154
seconds: 0,
156155
nanos: 4000000,
157156
},
157+
willBeRetried: false,
158158
},
159159
},
160160
{

features/fixtures/formatters/passed-rule.message.json.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ module.exports = [
154154
nanos: 0,
155155
},
156156
status: 'PASSED',
157-
willBeRetried: false,
158157
},
159158
timestamp: {
160159
seconds: 0,
@@ -169,6 +168,7 @@ module.exports = [
169168
seconds: 0,
170169
nanos: 4000000,
171170
},
171+
willBeRetried: false,
172172
},
173173
},
174174
{

features/fixtures/formatters/passed-scenario.message.json.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ module.exports = [
139139
nanos: 0,
140140
},
141141
status: 'PASSED',
142-
willBeRetried: false,
143142
},
144143
timestamp: {
145144
seconds: 0,
@@ -154,6 +153,7 @@ module.exports = [
154153
seconds: 0,
155154
nanos: 4000000,
156155
},
156+
willBeRetried: false,
157157
},
158158
},
159159
{

features/fixtures/formatters/retried.message.json.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ module.exports = [
139139
nanos: 0,
140140
},
141141
status: 'FAILED',
142-
willBeRetried: true,
143142
message: 'Error: my error',
144143
},
145144
timestamp: {
@@ -155,6 +154,7 @@ module.exports = [
155154
seconds: 0,
156155
nanos: 4000000,
157156
},
157+
willBeRetried: true,
158158
},
159159
},
160160
{
@@ -188,7 +188,6 @@ module.exports = [
188188
nanos: 0,
189189
},
190190
status: 'PASSED',
191-
willBeRetried: false,
192191
},
193192
timestamp: {
194193
seconds: 0,
@@ -203,6 +202,7 @@ module.exports = [
203202
seconds: 0,
204203
nanos: 8000000,
205204
},
205+
willBeRetried: false,
206206
},
207207
},
208208
{

0 commit comments

Comments
 (0)