Skip to content

Commit b04d6fe

Browse files
docs: call out change of after hook result in migration guide (#1692)
* document change of after hook result * better wording * whoops * Update docs/migration.md Co-authored-by: Aurélien Reeves <aurelien.reeves@smartbear.com> Co-authored-by: Aurélien Reeves <aurelien.reeves@smartbear.com>
1 parent 6f14033 commit b04d6fe

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

docs/migration.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,52 @@ You'll need to update any `import`/`require` statements in your support code to
1313

1414
(The executable is still `cucumber-js` though.)
1515

16+
## Hooks
17+
18+
The result object passed as the argument to your `After` hook function has a different structure.
19+
20+
Previously in `cucumber`:
21+
22+
```js
23+
{
24+
"sourceLocation": {
25+
"uri": "features/example.feature",
26+
"line": 7
27+
},
28+
"pickle": {...},
29+
"result": {
30+
"duration": 660000000,
31+
"status": "failed",
32+
"exception": {
33+
"name": "AssertionError",
34+
"message": "...",
35+
"showDiff": false,
36+
"stack": "..."
37+
},
38+
"retried": true
39+
}
40+
}
41+
```
42+
43+
Now in `@cucumber/cucumber`:
44+
45+
```js
46+
{
47+
"gherkinDocument": {...}, // schema: https://github.com/cucumber/common/blob/main/messages/jsonschema/GherkinDocument.json
48+
"pickle": {...}, // schema: https://github.com/cucumber/common/blob/main/messages/jsonschema/Pickle.json
49+
"testCaseStartedId": "[uuid]",
50+
"result": {
51+
"status": "FAILED", // one of: UNKNOWN, PASSED, SKIPPED, PENDING, UNDEFINED, AMBIGUOUS, FAILED
52+
"message": "...", // includes stack trace
53+
"duration": {
54+
"seconds": "0",
55+
"nanos": 660000000
56+
},
57+
"willBeRetried": true
58+
}
59+
}
60+
```
61+
1662
## Formatters
1763

1864
The underlying event/data model for cucumber-js is now [cucumber-messages](https://github.com/cucumber/cucumber/tree/master/messages), a shared standard across all official Cucumber implementations. This replaces the old "event protocol".
@@ -49,4 +95,4 @@ There are a few minor differences to be aware of:
4995
- The type for data tables was named `TableDefinition` - it's now named `DataTable`
5096
- `World` was typed as an interface, but it's actually a class - you should `extend` it when [building a custom formatter](./custom_formatters.md)
5197

52-
Also, your `tsconfig.json` should have the `resolveJsonModule` compiler option switched on. Other than that, a pretty standard TypeScript setup should work as expected.
98+
Also, your `tsconfig.json` should have the `resolveJsonModule` compiler option switched on. Other than that, a pretty standard TypeScript setup should work as expected.

0 commit comments

Comments
 (0)