Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update @cucumber/* dependencies, fix willBeRetried usage #1776

Merged
merged 14 commits into from
Sep 3, 2021
14 changes: 9 additions & 5 deletions compatibility/cck_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,20 @@ describe('Cucumber Compatibility Kit', () => {
const suiteName = match[1]
const extension = match[2]
it(`passes the cck suite for '${suiteName}'`, async () => {
const args = [
'node',
path.join(PROJECT_PATH, 'bin', 'cucumber-js'),
].concat([
const cliOptions = [
`${CCK_FEATURES_PATH}/${suiteName}/${suiteName}${extension}`,
'--require',
`${CCK_IMPLEMENTATIONS_PATH}/${suiteName}/${suiteName}.ts`,
'--profile',
'cck',
])
]
if (suiteName === 'retry') {
cliOptions.push('--retry', '2')
}
const args = [
'node',
path.join(PROJECT_PATH, 'bin', 'cucumber-js'),
].concat(cliOptions)
const stdout = new PassThrough()
try {
await new Cli({
Expand Down
21 changes: 19 additions & 2 deletions compatibility/features/attachments/attachments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,26 @@ When('a JPEG image is attached', async function (this: World) {
'compatibility-kit',
'features',
'attachments',
'cucumber-growing-on-vine.jpg'
'cucumber.png'
)
),
'image/jpg'
'image/png'
)
})

When('the {word} png is attached', async function (filename) {
await this.attach(
fs.createReadStream(
path.join(
process.cwd(),
'node_modules',
'@cucumber',
'compatibility-kit',
'features',
'attachments',
filename
)
),
'image/png'
)
})
25 changes: 25 additions & 0 deletions compatibility/features/retry/retry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Given } from '../../../src'

Given('a step that always passes', function () {
// no-op
})

let secondTimePass = 0
Given('a step that passes the second time', function () {
secondTimePass++
if (secondTimePass < 2) {
throw new Error('Exception in step')
}
})

let thirdTimePass = 0
Given('a step that passes the third time', function () {
thirdTimePass++
if (thirdTimePass < 3) {
throw new Error('Exception in step')
}
})

Given('a step that always fails', function () {
throw new Error('Exception in step')
})
3 changes: 1 addition & 2 deletions docs/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ Now in `@cucumber/cucumber`:
"duration": {
"seconds": "0",
"nanos": 660000000
},
"willBeRetried": true
}
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion features/fixtures/formatters/failed.message.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ module.exports = [
nanos: 0,
},
status: 'FAILED',
willBeRetried: false,
message: 'Error: my error',
},
timestamp: {
Expand All @@ -155,6 +154,7 @@ module.exports = [
seconds: 0,
nanos: 4000000,
},
willBeRetried: false,
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion features/fixtures/formatters/passed-rule.message.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ module.exports = [
nanos: 0,
},
status: 'PASSED',
willBeRetried: false,
},
timestamp: {
seconds: 0,
Expand All @@ -169,6 +168,7 @@ module.exports = [
seconds: 0,
nanos: 4000000,
},
willBeRetried: false,
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ module.exports = [
nanos: 0,
},
status: 'PASSED',
willBeRetried: false,
},
timestamp: {
seconds: 0,
Expand All @@ -154,6 +153,7 @@ module.exports = [
seconds: 0,
nanos: 4000000,
},
willBeRetried: false,
},
},
{
Expand Down
4 changes: 2 additions & 2 deletions features/fixtures/formatters/retried.message.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ module.exports = [
nanos: 0,
},
status: 'FAILED',
willBeRetried: true,
message: 'Error: my error',
},
timestamp: {
Expand All @@ -155,6 +154,7 @@ module.exports = [
seconds: 0,
nanos: 4000000,
},
willBeRetried: true,
},
},
{
Expand Down Expand Up @@ -188,7 +188,6 @@ module.exports = [
nanos: 0,
},
status: 'PASSED',
willBeRetried: false,
},
timestamp: {
seconds: 0,
Expand All @@ -203,6 +202,7 @@ module.exports = [
seconds: 0,
nanos: 8000000,
},
willBeRetried: false,
},
},
{
Expand Down
Loading