Skip to content

Commit

Permalink
Make transformer of defineParameterType optional
Browse files Browse the repository at this point in the history
This is to accurately reflect actual behavior [1].

This fixes #1179 [2].

[1] cucumber/cucumber-js#2397
[2] #1179
  • Loading branch information
badeball committed Apr 21, 2024
1 parent 055d8df commit 7ef825b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## Unreleased

- Fix type signature of `defineParameterType` to correctly reflect `transformer` property's optionality, fixes [#1179](https://github.com/badeball/cypress-cucumber-preprocessor/issues/1179).

## v20.0.3

- Handle browser / page crash gracefully, fixes [#1172](https://github.com/badeball/cypress-cucumber-preprocessor/issues/1172).
Expand Down
2 changes: 1 addition & 1 deletion lib/public-member-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as messages from "@cucumber/messages";
export interface IParameterTypeDefinition<T, C extends Mocha.Context> {
name: string;
regexp: RegExp;
transformer: (this: C, ...match: string[]) => T;
transformer?: (this: C, ...match: string[]) => T;
}

export interface IRunHookOptions {
Expand Down
5 changes: 5 additions & 0 deletions test-d/entrypoint-browser.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ defineParameterType({
},
});

defineParameterType({
name: "foo",
regexp: /foo/,
});

BeforeAll(function () {
expectType<Mocha.Context>(this);
});
Expand Down
5 changes: 5 additions & 0 deletions test-d/entrypoint-node.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ defineParameterType({
},
});

defineParameterType({
name: "foo",
regexp: /foo/,
});

BeforeAll(function () {
expectType<Mocha.Context>(this);
});
Expand Down

0 comments on commit 7ef825b

Please sign in to comment.