Skip to content

Commit

Permalink
Merge 3d1cd96 into 40daa76
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwynne committed Jan 14, 2022
2 parents 40daa76 + 3d1cd96 commit 5cb1b8b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
3 changes: 2 additions & 1 deletion compatibility/cck_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ describe('Cucumber Compatibility Kit', () => {
stdout.end()

const rawOutput = await toString(stdout)
// TODO: consider validating (at run-time) the parsed message is really an Envelope
const actualMessages = normalize(
rawOutput
.split('\n')
Expand Down Expand Up @@ -85,7 +86,7 @@ describe('Cucumber Compatibility Kit', () => {
})
})

function normalize(messages: any[]): any[] {
function normalize(messages: messages.Envelope[]): messages.Envelope[] {
messages = normalizeMessageOutput(
messages,
path.join(PROJECT_PATH, 'compatibility')
Expand Down
8 changes: 6 additions & 2 deletions compatibility/features/data-tables/data-tables.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { When, Then, DataTable } from '../../../src'
import { expect } from 'chai'

type World = {
transposed: DataTable
}

When(
'the following table is transposed:',
function (this: any, table: DataTable) {
function (this: World, table: DataTable) {
this.transposed = table.transpose()
}
)

Then('it should be:', function (this: any, expected: DataTable) {
Then('it should be:', function (this: World, expected: DataTable) {
expect(this.transposed.raw()).to.deep.eq(expected.raw())
})
17 changes: 12 additions & 5 deletions compatibility/features/examples-tables/examples-tables.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import assert from 'assert'
import { Given, When, Then } from '../../../src'

Given('there are {int} cucumbers', function (this: any, initialCount: number) {
this.count = initialCount
})
type World = {
count: number
}

Given(
'there are {int} cucumbers',
function (this: World, initialCount: number) {
this.count = initialCount
}
)

When('I eat {int} cucumbers', function (this: any, eatCount: number) {
When('I eat {int} cucumbers', function (this: World, eatCount: number) {
this.count -= eatCount
})

Then(
'I should have {int} cucumbers',
function (this: any, expectedCount: number) {
function (this: World, expectedCount: number) {
assert.strictEqual(this.count, expectedCount)
}
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Given } from '../../../src'

// eslint-disable-next-line @typescript-eslint/no-unused-vars
Given('{airport} is closed because of a strike', function (airport: any) {
Given('{airport} is closed because of a strike', function (airport: unknown) {
throw new Error('Should not be called because airport type not defined')
})

0 comments on commit 5cb1b8b

Please sign in to comment.