Skip to content

Commit 7ef825b

Browse files
committed
Make transformer of defineParameterType optional
This is to accurately reflect actual behavior [1]. This fixes #1179 [2]. [1] cucumber/cucumber-js#2397 [2] #1179
1 parent 055d8df commit 7ef825b

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

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

5+
## Unreleased
6+
7+
- Fix type signature of `defineParameterType` to correctly reflect `transformer` property's optionality, fixes [#1179](https://github.com/badeball/cypress-cucumber-preprocessor/issues/1179).
8+
59
## v20.0.3
610

711
- Handle browser / page crash gracefully, fixes [#1172](https://github.com/badeball/cypress-cucumber-preprocessor/issues/1172).

lib/public-member-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as messages from "@cucumber/messages";
33
export interface IParameterTypeDefinition<T, C extends Mocha.Context> {
44
name: string;
55
regexp: RegExp;
6-
transformer: (this: C, ...match: string[]) => T;
6+
transformer?: (this: C, ...match: string[]) => T;
77
}
88

99
export interface IRunHookOptions {

test-d/entrypoint-browser.test-d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ defineParameterType({
140140
},
141141
});
142142

143+
defineParameterType({
144+
name: "foo",
145+
regexp: /foo/,
146+
});
147+
143148
BeforeAll(function () {
144149
expectType<Mocha.Context>(this);
145150
});

test-d/entrypoint-node.test-d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ defineParameterType({
140140
},
141141
});
142142

143+
defineParameterType({
144+
name: "foo",
145+
regexp: /foo/,
146+
});
147+
143148
BeforeAll(function () {
144149
expectType<Mocha.Context>(this);
145150
});

0 commit comments

Comments
 (0)