-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for custom parameter types
- Loading branch information
Showing
6 changed files
with
88 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
"quickpickle": minor | ||
--- | ||
|
||
Added support for [custom parameter types], exactly as in CucumberJS. | ||
A simple example: | ||
|
||
```ts | ||
// Step definition file | ||
defineParameterType({ | ||
name: 'updown', | ||
regexp: /(up|down)/, | ||
}) | ||
Given('a number {int}', (world,num) => { | ||
world.number = num | ||
}) | ||
When('the number goes {updown} {int}', (world, updown, num) => { | ||
if (updown === 'up') world.number += num | ||
else world.number -= num | ||
}) | ||
Then('the number should be {int}', (world, num) => { | ||
expect(world.number).toBe(num) | ||
}) | ||
``` | ||
|
||
```gherkin | ||
Feature: Custom parameter types | ||
Scenario: The number | ||
Given a number 4 | ||
When the number goes up 5 | ||
Then the number should be 9 | ||
``` | ||
|
||
[custom parameter types]: https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/api_reference.md#defineparametertypename-preferforregexpmatch-regexp-transformer-useforsnippets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters