From 6ff3d48e13dd4944cb8ac22c23c76b0ac6708153 Mon Sep 17 00:00:00 2001 From: David Goss Date: Thu, 3 Jun 2021 11:38:42 +0100 Subject: [PATCH 1/4] document change of after hook result --- docs/migration.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/docs/migration.md b/docs/migration.md index b965f9b6a..710669368 100644 --- a/docs/migration.md +++ b/docs/migration.md @@ -13,6 +13,52 @@ You'll need to update any `import`/`require` statements in your support code to (The executable is still `cucumber-js` though.) +## Hooks + +The result object passed as the second argument to your `After` hook function has a different structure. + +Before: + +```js +{ + "sourceLocation": { + "uri": "features/example.feature", + "line": 7 + }, + "pickle": {...}, + "result": { + "duration": 660000000, + "status": "failed", + "exception": { + "name": "AssertionError", + "message": "...", + "showDiff": false, + "stack": "..." + }, + "retried": true + } +} +``` + +After: + +```js +{ + "gherkinDocument": {...}, // schema: https://github.com/cucumber/common/blob/main/messages/jsonschema/GherkinDocument.json + "pickle": {...}, // schema: https://github.com/cucumber/common/blob/main/messages/jsonschema/Pickle.json + "testCaseStartedId": "[uuid]", + "result": { + "status": "FAILED", // one of: UNKNOWN, PASSED, SKIPPED, PENDING, UNDEFINED, AMBIGUOUS, FAILED + "message": "...", // includes stack trace + "duration": { + "seconds": "0", + "nanos": 660000000 + }, + "willBeRetried": true + } +} +``` + ## Formatters 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: - The type for data tables was named `TableDefinition` - it's now named `DataTable` - `World` was typed as an interface, but it's actually a class - you should `extend` it when [building a custom formatter](./custom_formatters.md) -Also, your `tsconfig.json` should have the `resolveJsonModule` compiler option switched on. Other than that, a pretty standard TypeScript setup should work as expected. \ No newline at end of file +Also, your `tsconfig.json` should have the `resolveJsonModule` compiler option switched on. Other than that, a pretty standard TypeScript setup should work as expected. From d21c17168cb92825d1af277dd1dec1fe4ac45a1f Mon Sep 17 00:00:00 2001 From: David Goss Date: Thu, 3 Jun 2021 11:42:37 +0100 Subject: [PATCH 2/4] better wording --- docs/migration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/migration.md b/docs/migration.md index 710669368..fdd7501fa 100644 --- a/docs/migration.md +++ b/docs/migration.md @@ -17,7 +17,7 @@ You'll need to update any `import`/`require` statements in your support code to The result object passed as the second argument to your `After` hook function has a different structure. -Before: +Previous in `cucumber`: ```js { @@ -40,7 +40,7 @@ Before: } ``` -After: +Now in `@cucumber/cucumber`: ```js { From 4dac1f40a46fbd3be07c01cac0b39821d22e0b23 Mon Sep 17 00:00:00 2001 From: David Goss Date: Thu, 3 Jun 2021 11:43:53 +0100 Subject: [PATCH 3/4] whoops --- docs/migration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/migration.md b/docs/migration.md index fdd7501fa..6db672b9e 100644 --- a/docs/migration.md +++ b/docs/migration.md @@ -15,7 +15,7 @@ You'll need to update any `import`/`require` statements in your support code to ## Hooks -The result object passed as the second argument to your `After` hook function has a different structure. +The result object passed as the argument to your `After` hook function has a different structure. Previous in `cucumber`: From bf6af120f6a8de5811e3fb3612282aa644d5ae88 Mon Sep 17 00:00:00 2001 From: David Goss Date: Thu, 3 Jun 2021 15:49:43 +0100 Subject: [PATCH 4/4] Update docs/migration.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Aurélien Reeves --- docs/migration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/migration.md b/docs/migration.md index 6db672b9e..4f9841279 100644 --- a/docs/migration.md +++ b/docs/migration.md @@ -17,7 +17,7 @@ You'll need to update any `import`/`require` statements in your support code to The result object passed as the argument to your `After` hook function has a different structure. -Previous in `cucumber`: +Previously in `cucumber`: ```js {