Skip to content

Commit

Permalink
chore: update @cucumber/* dependencies, fix willBeRetried usage (#1776)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
davidjgoss committed Sep 3, 2021
1 parent 4e85157 commit 8f2ff57
Show file tree
Hide file tree
Showing 21 changed files with 227 additions and 208 deletions.
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

0 comments on commit 8f2ff57

Please sign in to comment.