diff --git a/compatibility/cck_spec.ts b/compatibility/cck_spec.ts index a9f834572..c0d2ce48d 100644 --- a/compatibility/cck_spec.ts +++ b/compatibility/cck_spec.ts @@ -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') @@ -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') diff --git a/compatibility/features/data-tables/data-tables.ts b/compatibility/features/data-tables/data-tables.ts index e901273fa..168180f3c 100644 --- a/compatibility/features/data-tables/data-tables.ts +++ b/compatibility/features/data-tables/data-tables.ts @@ -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()) }) diff --git a/compatibility/features/examples-tables/examples-tables.ts b/compatibility/features/examples-tables/examples-tables.ts index e259bd958..e824a1792 100644 --- a/compatibility/features/examples-tables/examples-tables.ts +++ b/compatibility/features/examples-tables/examples-tables.ts @@ -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) } ) diff --git a/compatibility/features/unknown-parameter-type/unknown-parameter-type.ts b/compatibility/features/unknown-parameter-type/unknown-parameter-type.ts index e6611990c..4d56e21ae 100644 --- a/compatibility/features/unknown-parameter-type/unknown-parameter-type.ts +++ b/compatibility/features/unknown-parameter-type/unknown-parameter-type.ts @@ -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') })