Skip to content

Commit 1e3643a

Browse files
committed
Some cleanup after #1128
Primarily introducing scenario outlines as a shorter alternative.
1 parent c6358a7 commit 1e3643a

File tree

5 files changed

+132
-555
lines changed

5 files changed

+132
-555
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+
- Add order option to all hooks, fixes [#481](https://github.com/badeball/cypress-cucumber-preprocessor/issues/481).
8+
59
## v19.1.1
610

711
- Mock and imitate Cypress globals during diagnostics / dry run, fixes [#1120](https://github.com/badeball/cypress-cucumber-preprocessor/issues/1120).

docs/cucumber-basics.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- [Run hooks](#run-hooks)
1414
- [Scenario hooks](#scenario-hooks)
1515
- [Step hooks](#step-hooks)
16+
- [Hook ordering](#hook-ordering)
1617
- [Named hooks](#named-hooks)
1718

1819
# Step definitions
@@ -220,6 +221,18 @@ BeforeStep(function ({ pickle, pickleStep, gherkinDocument, testCaseStartedId, t
220221

221222
[^1]: This discrepancy between the preprocessor and cucumber-js is currently considered to be unsolvable, as explained [here](https://github.com/badeball/cypress-cucumber-preprocessor/issues/824#issuecomment-1561492281).
222223

224+
## Hook ordering
225+
226+
You can specify an explicit order for hooks if you need to. The default order is 10000. Before-type hooks are executed in ascending order, while After-type hooks are executed in descending order.
227+
228+
```ts
229+
import { Before, BeforeStep, After, AfterStep } from "@badeball/cypress-cucumber-preprocessor";
230+
231+
BeforeAll({ order: 10 }, function () {});
232+
Before({ order: 10 }, function () {});
233+
BeforeStep({ order: 10 }, function () {});
234+
```
235+
223236
## Named hooks
224237

225238
Both scenario hooks and step hooks can optionally be named. Names are displayed in the command log, as well as in [messages reports](messages-report.md).

0 commit comments

Comments
 (0)